hello :) I thought about implementing an "intelligent" size thingy into my program. So that, when the user resizes his Window - the next time he starts the app it will have the same width and height. I tried like this: if umsg==WM_SIZE mov WinWidth,WORD PTR ;lparamLO mov WinHeight,WORD PTR ;lparamHI ->save this to registry .endif and it saves two values into the registry, but when I restart the app.. it reads the values but my movewindow call resizes my app to the correct width, but a height equal to zero. Am I on the right track? Anyone knows an easier way? Someone got a codesnippet to peek at?
Posted on 2001-04-03 14:38:00 by JimmyClif
Salut JimmyClif, Personnellement, j'utilise GetWindowRect avec la structure RECT et ša marche bien. Mais logiquement ce que t'a fait, ša devrais marcher, faut trouver la faille. Bonnes Vacances.
Posted on 2001-04-03 15:40:00 by Vom-bonjour:-()
There just happens to be a few API's designed for just that trick... look at the platform SDK for: BeginDeferWindowPos(...) DeferWindowPos(...) EndDeferWindowPos(...) Requires Windows 95 or later, NT 3.1 or later Happy Coding, _Shawn Update: Oh... I didn't see the registry part... oops. In that case, these API's don't help. Sorry... This message was edited by _shawn, on 4/3/2001 4:21:23 PM
Posted on 2001-04-03 16:19:00 by _Shawn
Jimmy, I like your train of thought. As a user, it frustrates me to carefully resize and position a window just where I need it, and just because I close it doesn't mean I want it back centered at some default size. It's not hard to do, in WinMain (not the message loop) just create your top window invisible, read back the size and position (ini file, registry, whatever, your choice), setWindowPos to that, and at the same time, SHOW THAT WINDOW. Works nicely at that.
Posted on 2001-04-03 23:20:00 by Ernie
Would it not be better to get the dimensions of the window on closing? It'd save registry thrashing! Mirno
Posted on 2001-04-04 05:57:00 by Mirno
Why don't you use the GetWindowPlacement and SetWindowPlacement functions? If you store all the info that is returned from GetWindowPlacement, you are also storing/retrieving the restored rectangle, along with the maximized/minimized status, etc Use the GetWindowPlacement when you start the app, and SetWindowPlacement before you destroy the main window. Nick
Posted on 2001-04-04 06:43:00 by Nick
Thanks, I'll check all those methods as soon as I get home and try to learn the most out of it ;) [Actually I'm just doing this because I'm too lazy to calculate the window height and width on the fly during startup. *g*]
Posted on 2001-04-04 11:19:00 by JimmyClif
Jimmy if this is what you want: Quote================ So that, when the user resizes his Window - the next time he starts the app it will have the same width and height. End================== You don't need to get posiotion of the window all the time. All you need to get the posiotion is responce of WM_CLOSE message. Then return 0. The Svin.
Posted on 2001-04-04 11:46:00 by The Svin
True Svin, I didn't try this first because I thought if the user minimized the app on closing (right-click) it would start minimized but this isn't so :) It works great now!
Posted on 2001-04-04 13:24:00 by JimmyClif