I have a program which prints the contents of a RichEdit, the data it prints needs to be printed in landscape, is there a way of recording the print setting so that you dont have to alter them eveytime you start the program ?...
Well, i can think of 2 ways:
1: Use the registry. Make some register values with the proper name to save it in. Look in help on TRegistry (hmmm...the spelling..).
2: Make/use a setting-file. This can be done in so many ways but i use to do a:
struct
{
int Printer_Format_Landscape; // true or false
// other settings and such
} Config;
To save the Config:
void __fastcall TForm1::Save_Configuration(char * File_Name)
{
HANDLE Config_File = CreateFile(File_Name,GENERIC_WRITE,0,0,CREATE_ALWAYS,FILE_ATTRIBUTE_ARCHIVE,0);
if(Config_File != INVALID_HANDLE_VALUE)
{
CloseHandle(Config_File);
}
}
To restore the Config:
int __fastcall TForm1::Load_Configuration(char * File_Name)
{
HANDLE Config_File = CreateFile(File_Name,GENERIC_WRITE,0,0,OPEN_EXISTING,FILE_ATTRIBUTE_ARCHIVE,0);
if(Config_File != INVALID_HANDLE_VALUE)
{
CloseHandle(Config_File);
return(true); // All's well
}
return(false); // The file does not exist
}
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.