Einzelnen Beitrag anzeigen

fnhofm

Registriert seit: 16. Mär 2006
Ort: Nürnberg
25 Beiträge
 
Delphi XE2 Professional
 
#5

Re: How to handle window move?

  Alt 31. Mai 2010, 13:16
Hi,

you can use this code in the close or destroy event handler of the form (I used a TMemIniFile)

Delphi-Quellcode:
var
  LWindowPlacement: TWindowPlacement;
begin
  Ini.WriteInteger(Name, 'WindowState', Integer(WindowState));
  LWindowPlacement.length := SizeOf(TWindowPlacement);

  if GetWindowPlacement(Handle, LWindowPlacement) then
  begin
    Ini.WriteInteger(Name, 'Top', LWindowPlacement.rcNormalPosition.Top);
    Ini.WriteInteger(Name, 'Left', LWindowPlacement.rcNormalPosition.Left);
    Ini.WriteInteger(Name, 'Height',
      LWindowPlacement.rcNormalPosition.Bottom - LWindowPlacement.rcNormalPosition.Top);
    Ini.WriteInteger(Name, 'Width',
      LWindowPlacement.rcNormalPosition.Right - LWindowPlacement.rcNormalPosition.Left);
  end;
  Ini.UpdateFile;
end;
Hope this helps.
  Mit Zitat antworten Zitat