I have been using the following code with success in Windows 9X and XP
by using tIniFile.

Put IniSettings:

      if WindowState = wsNormal then begin
        WriteInteger ('Position', 'Top', Top);
        WriteInteger ('Position', 'Left', Left);
        WriteInteger ('Position', 'Height', Height);
        WriteInteger ('Position', 'Width', Width);
        end;
      WriteInteger ('Position', 'State',  ord (WindowState));

GetIniSettings:

      Top := ReadInteger ('Position', 'Top', 1);
      Left := ReadInteger ('Position', 'Left', 1);
      Width := ReadInteger ('Position', 'Width', Width);
      Height := ReadInteger ('Position', 'Height', Height);
      WindowState := TWindowState (ReadInteger ('Position', 'State',
wsNormal));
// Note: Window State must come after Top, Left and Height.

But this does not store the last normalized position and size if a
form is normalized, maximized and then closed.

I hadn't previously been aware of SetWindowPlacement. I will have to
try it out as it looks as though it may make things a bit simpler.

Henry Bartlett
Delphi Links Page:
( http://www.hotkey.net.au/~hambar/habit/delflink.htm )


_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to