Menu Search

Borland Delphi

Save and Restore Window Position (Registry)
procedure ReadFromRegistry;
var
R : TRegistry;
begin
R := TRegistry.Create;
try
R.RootKey := HKEY_CURRENT_USER;
if R.OpenKey('SoftwareNullifiedSaveRestoreForm?, False) then
begin
Form1.left:=R.ReadInteger('left');
Form1.top:=R.ReadInteger('top');
Form1.height:=R.ReadInteger('height');
Form1.width:=R.ReadInteger('width');
end;
Finally
R.CloseKey;
R.Free;
end;
end;


procedure WriteToRegistry;
var
R : TRegistry;
begin
R := TRegistry.Create;
try
R.RootKey := HKEY_CURRENT_USER;
if R.OpenKey('SoftwareNullifiedSaveRestoreForm?, True) then
R.WriteInteger('left?,Form1.Left);
R.WriteInteger('top?,Form1.Top);
R.WriteInteger('height?, Form1.Height);
R.WriteInteger('width?, Form1.Width);
Finally
R.CloseKey;
R.Free;
end;
end;

procedure TForm1.FormCloseSave(Sender: TObject; var Action: TCloseAction);
var
R : TRegistry;
begin
R := TRegistry.Create;
try
R.RootKey := HKEY_CURRENT_USER;
if R.OpenKey('SoftwareNullifiedSaveRestoreForm?, True) then
R.WriteInteger('left?,Form1.Left);
R.WriteInteger('top?,Form1.Top);
R.WriteInteger('height?, Form1.Height);
R.WriteInteger('width?, Form1.Width);
Finally
R.CloseKey;
R.Free;
end;
end;

For Example:
var
AppName : PChar;
begin
AppName := PChar( Application.ExeName );
ShellExecute( Handle, ?open?, AppName, nil, nil, SW_SHOWNORMAL );
close;

Liste

Index | List
  • Vorherige
  • Seite #n
  • #n
  • #c
  • Seite #n
  • Nächste
Index | List
  • Vorherige
  • Seite #n
  • #n
  • #c
  • Seite #n
  • Nächste

Index

Index | List
  • Vorherige
  • Seite #n
  • #n
  • #c
  • Seite #n
  • Nächste
Index | List
  • Vorherige
  • Seite #n
  • #n
  • #c
  • Seite #n
  • Nächste

LetzteChance.Org - Links -

PDF/ZIP/Word