program Project1;
uses
MidasLib,
Forms,
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
Reference: Cary Jensen, http://dn.codegear.com/article/29297
program Project1;
uses
MidasLib,
Forms,
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
Dialogs ----> TPrinterSetupDialog;
Printers ----> TPrinter
IniFiles----> TIniFile
procedure TForm1.FormCreate(Sender: TObject);
var
IniFile : TIniFile;
begin
IniFile := TIniFile.Create(ExtractFilePath(Application.ExeName) + 'configuration.ini');
// Read the value from the ini file
PrinterIndex := IniFile.ReadInteger('Printer','Index',0);
IniFile.Free;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
var
IniFile : TIniFile;
begin
IniFile := TIniFile.Create(ExtractFilePath(Application.ExeName) + 'configuration.ini');
// Save the value into the ini file
IniFile.WriteInteger('Printer','Index',PrinterIndex);
IniFile.Free;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
// Change current printer index to the value we get from the ini file.
Printer.PrinterIndex := PrinterIndex;
ShowMessage(IntToStr(Printer.PrinterIndex));
// Open the dialog
PrinterSetupDialog1.Execute;
// Set new value to the PrinterIndex variable.
ShowMessage(IntToStr(Printer.PrinterIndex));
PrinterIndex := Printer.PrinterIndex;
...
...
procedure ShowText();
var
s : String;
i : Integer;
begin
s := 'is another way to think about what you x';
s[1] := UpCase(s[1]);
for i := 1 to Length(s) do
begin
if s[i] = ' ' then
if i < Length(s) then
s[i+1] := UpCase(s[i+1]);
end;
ShowMessage(s);
end;