How do you lock a window's size?
I''m creating a 2D tile based game that runs on the GDI (hey! its for practice!). I noticed that whenever I resize the window, the tiles will dispear until the window is resized to a certain place. I don''t know if this has to do with aspect ratio or what, but I certainly don''t want the user doing it! Is it possible to prevent a window from being resized? How would I go about doing this? Thanks!
There is no spoon.
Trap the WM_SIZE message inside your WinProc function and just return so that it does nothing.
From MSDN: WM_SIZE
--------
Andrew
From MSDN: WM_SIZE
--------
Andrew
It is easier not to give the window the WS_THICKFRAME style. Give it the WS_BORDER style instead.
Edit: acraig, are you sure about WM_SIZE? I just checked the VC 5 help and there it is only a message to notify you of the fact the window size changed. Maybe you confused it with WM_SIZING?
Edited by - BitMaster on September 27, 2000 3:25:30 PM
Edit: acraig, are you sure about WM_SIZE? I just checked the VC 5 help and there it is only a message to notify you of the fact the window size changed. Maybe you confused it with WM_SIZING?
Edited by - BitMaster on September 27, 2000 3:25:30 PM
quote: Original post by BitMaster
Edit: acraig, are you sure about WM_SIZE? I just checked the VC 5 help and there it is only a message to notify you of the fact the window size changed. Maybe you confused it with WM_SIZING?
Quite possibly. I usually test stuff out before I post a response but I am at work so no Windows stuff . I knew it was some WM_* message .
---------
Andrew
Check WM_GETMINMAXINFO in your help.
For example, if you don''t want your window to be sized smaller than (200,100) try the following:
For example, if you don''t want your window to be sized smaller than (200,100) try the following:
case WM_GETMINMAXINFO: { LPMINMAXINFO pmmi = (LPMINMAXINFO) lParam; // address of structure pmmi->ptMinTrackSize.x = 200; pmmi->ptMinTrackSize.y = 100; return 0; }
Baskuenen, could you then do:
Effectively limiting the window to no smaller AND no larger than 800x600?
case WM_GETMINMAXINFO:{ LPMINMAXINFO pmmi = (LPMINMAXINFO) lParam; pmmi->ptMaxTrackSize.x = 800;pmmi->ptMaxTrackSize.y = 600;return 0;}
Effectively limiting the window to no smaller AND no larger than 800x600?
There is no spoon.
If you don''t want the user to even resize your window, I''d go with the first thing BitMaster said: get rid of the WS_THICKFRAME or WS_SIZEBOX window style.
When I want a window that can''t be resized or maximized, I use this for the window style:
WS_OVERLAPPED | WS_VISIBLE | WS_SYSMENU | WS_MINIMIZEBOX
-Ironblayde
Aeon Software
WS_OVERLAPPED | WS_VISIBLE | WS_SYSMENU | WS_MINIMIZEBOX
-Ironblayde
Aeon Software
"Your superior intellect is no match for our puny weapons!"
Cool thanks! The only bad part is that it changing the style to WS_BORDER takes away the minimize, maximize, and close buttons! If I handt had the file menu implemented, you couldnt close the bitch! Any suggestions to prevent resizing AND still have regular windows functionality?
Damn SQL errors... well this post was a little old, I will try some of your suggestions.
Edited by - Orpheum on September 28, 2000 7:15:32 PM
Damn SQL errors... well this post was a little old, I will try some of your suggestions.
Edited by - Orpheum on September 28, 2000 7:15:32 PM
There is no spoon.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement