Hello:
I've created a Single window and would like to avoid resizing it each time it's displayed.
What should I do ?
Any suggestion will be much appreciated.
Thanks a lot.
Best regards.
Frandy
Printable View
Hello:
I've created a Single window and would like to avoid resizing it each time it's displayed.
What should I do ?
Any suggestion will be much appreciated.
Thanks a lot.
Best regards.
Frandy
Umm...I'm not sure what you mean by resizing it every time it's displayed. Do you mean every time you create and show it or just every time it's drawn?
Either way...you're in complete control over the window's resizing if you're sizing it yourself....so if you don't want it to resize, just get rid of your code that's resizing it.
Or if you are creating it the wrong size, create it the right size!
Of course, I can resize the window when it is displayed ! But I would like to 'freeze' the size that I need so that it remains unmodified each time I launch the project to avoid resizing it again. I hope I have been clearer now?
Thanks again for any reply.
Best regards.
Frandy
Not exactely... If you want the window to be the same size everytime you create it, then just use the same window size values with CreateWindowEx(). If you want to keep the user from resizing it, then don't use the resizable border style for the window.
If you're the one setting the size, and the user can't resize the window...then...well, just set it to the same size every time.
If you don't want the user to be able to resize, get rid of the resize style for your window.
If you want to remember the last size of the window since the last launch, save it in the registry or in a file somewhere.
Thanks for your replies.
As I'm a beginner, I need more details.
Please tell me how I can save the last size of the window in the registry or in a file.
(The window is an SDI one created by means of the AppWizard, not from scratch)
Best regards.
Frandy
See the SrWin sample on this page.
Windows C Snippets
Tnx anonytmouse.
I added SRWIN.C to my project but got a fatal error C1010 :'Unexpected end of file while looking for precompiled header direction'.
What should I do ?
Best regards.
Frandy
I am still not clear what it is you are trying to do. Saving the size in the registry may be a sledge hammer cracking a very small nut.
You create the window and it has the size you specified when you create it. That size is not correct, so you change the size. When you open the application again, it has returned to the original size.
That is how I read the situation, and is, of course what should happen, it will open at the size YOU TELL IT to open at. So tell it to open at the correct size.
Or am I still not seeing this right?
You do see it right my dear but I don't know how and where I should TELL IT the size to open at. Is it in the Main Frame , in the OnCreate() or in the CMainFrame:PreCreateWindow() functions ?
Anyhow, thanks for helping me.
Best regards.
Frandy