Original Post
hi Everyone, Does anyone knows how to stop a WinApi window getting to small? Many Thanks.
Quote:
Original post by ncsu121978
capture the WM_SIZE message and dont let the window size go below what you specify
if(uMsg == WM_SIZE){ // Resize The Window if(HIWORD(lParam) < 100) return 0; if(LOWORD(lParam) < 100) return 0; ....case WM_GETMINMAXINFO: { LPMINMAXINFO mmi = reinterpret_cast<LPMINMAXINFO>(lParam); mmi->ptMinTrackSize.x = min_x_size; mmi->ptMinTrackSize.y = min_y_size;} return 0;Quote:
Original post by Erik Rufelt
You should instead capture the WM_GETMINMAXINFO message.
Something like this:case WM_GETMINMAXINFO: { LPMINMAXINFO mmi = reinterpret_cast<LPMINMAXINFO>(lParam); mmi->ptMinTrackSize.x = min_x_size; mmi->ptMinTrackSize.y = min_y_size;} return 0;
For most messages, you should always return zero when you handle them. Only for a few messages, such as WM_CREATE for example, does the return value change much. If you look up the MSDN page for the message you can see what you're supposed to return.
For the WM_GETMINMAXINFO: http://msdn.microsoft.com/en-us/library/ms632626(VS.85).aspx
EDIT: If you visit that webpage, and select WM_SIZE in the left column instead, you will see that it says WM_SIZE is only sent after the window is resized, which is why it's not a good idea to use that message.
You might also want to check out the WM_SIZING message, which allows for controlling the size of the window.
This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more