Link to home
Start Free TrialLog in
Avatar of win32
win32

asked on

Overloading onSize

Hi

I wanna overload onsize, but not realy sure how to do it. Problem: My application is resizeable... but the application should not be smaler then 400 * 400.

OnSize(..)
{
  //When new size is smaler then 500 * 500 pixels.. don't   resize
}

But, how is that done ?

CB
Avatar of Zoppo
Zoppo
Flag of Germany image

Hi win32,

to avoid flickering it's better to restrict window-sizes by handling the WM_GETMINMAXINFO
message. Override CWnd::OnGetMinMaxInfo() for your window's class and in there simply
set the ptMinTrackSize member of the passed MINMAXINFO to 500, 500.

hope that helps,

ZOPPO
ASKER CERTIFIED SOLUTION
Avatar of captainkirk
captainkirk

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of win32
win32

ASKER

I have doen like this:

void CChildView::OnGetMinMaxInfo( MINMAXINFO FAR* lpMMI )
{
     POINT pMin;
     pMin.x = 100;
     pMin.y = 100;
     lpMMI->ptMinTrackSize = pMin;
     CWnd::OnGetMinMaxInfo(lpMMI);
}


But it does not work ???
Thought you wanted it to be 400 * 400 or 500 * 500???

Also, looks like you want to make sure a child frame in an MDI app is what you want to restrict, correct??
And, maybe you should modify the values after you called CWnd::OnGetMinMaxInfo()
coz maybe there the values are modified again...
Avatar of win32

ASKER

Hmm I made a mistake, I was modifying a child wnd to the main wnd.. now it works :-)
:(

I'm not happy about this because you simply accepted captainkirk's comment as answer
without telling a reason what's wrong with my comment.
zoppo - I'd like to give you the points 'cuz you were the one who made the correct suggestion first -- look for a Q in the MFC section.... see ya later...