Windows layout
Hi
I make win32 layout (win32 sdk) and i want to know how to stop
the window resizing event. (when window reach the min size)
thanks
Handle the WM_SIZING message. If the RECT stored in the LPARAM is too small, change it to be the minimum size, otherwise simply let the message pass.
Colin Jeanne | Invader''s Realm
Colin Jeanne | Invader''s Realm
Here try this:
EDIT: ok, got the bugs worked out.
[edited by - microdot on November 9, 2003 4:48:24 AM]
LRESULT CALLBACK window_proc( HWND window_handle, UINT message_id, WPARAM word_param, LPARAM long_param){ static SIZE min_size = { /* you know what goes here }; switch ( message_id ) { // window procedure stuff here... case WM_SIZING: if ( ((RECT*)long_param)->right < min_width ) { ((RECT*)long_param)->right = min_size.cx; } if ( ((RECT*)long_param)->bottom < min_height ) { ((RECT*)long_param)->bottom = min_size.cy; } // more window procedure stuff here... default: return DefWindowProc ( window_handle, message_id, word_param, long_param );}
EDIT: ok, got the bugs worked out.
[edited by - microdot on November 9, 2003 4:48:24 AM]
WM_GETMINMAXINFO will be sent everytime when resizing. You can specify min and max sizes for the window size rect.
sorry, it doesnt work !
after the WM_GETMINMAXINFO message, i use
SetWindowPos(hwnd, 0, 0, 0, minW, minH, SWP_NOMOVE | SWP_NOZORDER);
after the WM_GETMINMAXINFO message, i use
SetWindowPos(hwnd, 0, 0, 0, minW, minH, SWP_NOMOVE | SWP_NOZORDER);
WM_GETMINMAXINFO will give you the pointer to a structure.
Just fill in the wanted params and return zero (like the docs say).
Don''t use SetWindowPos or any other sizing command in the proc. Windows will take care of the sizing by itself.
Just fill in the wanted params and return zero (like the docs say).
Don''t use SetWindowPos or any other sizing command in the proc. Windows will take care of the sizing by itself.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement