Board index » cppbuilder » Save size and position / maximize ??

Save size and position / maximize ??


2007-12-05 07:59:55 AM
cppbuilder73
Hi there
I an curently saveing the size and position of my app
to an inifile, easy.
If the program is maximize when being closed ist should
of course open again as maximize, also easy.
My problem is that i would like to save the size the
window had before it was maximized so that when the
window is restored it would NOT be in fulscrean.
I have tried to save the size and pos in Form::Resize
but unfortunatly the WindowState is set after the Resize
event so that code like this:
if(WindowState == wsNormal)
//save size and pos
don't work.
Anybody know how I can do this ??
Thanks in advance
Kind regards
Asger
 
 

Re:Save size and position / maximize ??

"Asger Joergensen" < XXXX@XXXXX.COM >wrote in message
Quote
My problem is that i would like to save the size the window
had before it was maximized so that when the window is
restored it would NOT be in fulscrean.
You need to use the Win32 API Get/SetWindowPlacement() functions to
retreive/restore that information. Those functions also handle the
minimized/maximized state for you as well.
Gambit
 

Re:Save size and position / maximize ??

Hi Remy
Remy Lebeau (TeamB) says:
Quote

"Asger Joergensen" < XXXX@XXXXX.COM >wrote in message
news: XXXX@XXXXX.COM ...

>My problem is that i would like to save the size the window
>had before it was maximized so that when the window is
>restored it would NOT be in fulscrean.

You need to use the Win32 API Get/SetWindowPlacement() functions to
retreive/restore that information. Those functions also handle the
minimized/maximized state for you as well.
Thank You very much, that is defenetly a step in the
right direction, but when I use GetWindowPlacement
in the OnClose event i get the size and position
the window had the first time it was shown, not the
size and pos. it had just before it was maximized.
Do you have a solution for that as well ?
Thanks again
Kind regards
Asger
 

{smallsort}

Re:Save size and position / maximize ??

Sory Remy
That was my mistake, it works like a charm.
Kind regards
Asger