Windows layout

Started by
7 comments, last by encom 20 years, 5 months ago
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
Advertisement
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
if i let the message pass, the window stay sizable
Here try this:

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]
<span class="smallfont">That is not dead which can eternal lieAnd with strange aeons even death may die.   -- "The Nameless City" - H. P. Lovecraft</span>
WM_GETMINMAXINFO will be sent everytime when resizing. You can specify min and max sizes for the window size rect.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

ok, forget what i said and do what Endurion said.
<span class="smallfont">That is not dead which can eternal lieAnd with strange aeons even death may die.   -- "The Nameless City" - H. P. Lovecraft</span>
sorry, it doesnt work !
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.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

Ok,

it works now, thanks for all

This topic is closed to new replies.

Advertisement