Click to See Complete Forum and Search --> : preventing resize on a window


August 10th, 1999, 08:25 AM
Hello,

This sounds very simple, all I want is to prevent users from being able to
resize the window of a program I made using MFC... please help.
thank you.

James Dunning
August 10th, 1999, 08:40 AM
Yep sure is simple, all you have to do is open up your classwizard select the view class in question, and override the message handler for WM_SIZING...

once you have done this, the classwizard will create message handler for WM_SIZING, all you need to do is comment out the OnSizing Call to the base class..

hope this helps
James

hope this helps
James

August 11th, 1999, 08:36 AM
James,

Thank you for your tip... however, I can't seem to make it work.. I handled
the WM_SIZING for the MainFrame class, but it did not work. When, I tried to
do the same thing with the WM_SIZE message, I can still resize the window. And if I try to make the window bigger than the original size, portions of the view
are not repainted..

Is there a way that I can stop the cursor from changing to the Horizontal and Vertical Resize cursors whenever it is positioned on the edge of my window?

thanks again..

Steve Dwire
August 11th, 1999, 06:31 PM
In CMainFrame::PreCreateWindow(...), replace
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs


with
cs.style &= ~WS_THICKFRAME;


If you also want to prevent minimizing and maximizing, add these lines:
cs.style &= ~WS_MINIMIZEBOX;
cs.style &= ~WS_MAXIMIZEBOX;

Uli Hecker
August 12th, 1999, 07:37 AM
Ever tried to override OnGetMinMaxInfo

?