How to Disable Resizing in SDI

1. I want to disable the resize function in the SDI program. It means user will not be able to resize the frame. How can I do that?

2. I want to resize the frame to certain size, so the view area has the same size as the Dialog I put in.

Example: A dialog is 320*240, I put this dialog into the view area. I need this area has the same size 320*240, and I don't want user to resize the frame.
dev_yinzAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

alb66Commented:
Ovveride PreCreateWindow() in your mainframe window:

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
      // call default implementation
      if( !CFrameWnd::PreCreateWindow(cs) )
            return FALSE;

      // fix the dimension
      cs.cx = 640;
      cs.cy = 480;

      // disable sizing
      cs.style &= ~WS_THICKFRAME;

      return TRUE;
}
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
alb66Commented:
Also consider an MDI scenario using CFormView instead of CDialog.
CFormView acts like a normal view (can fits the client area of the main frame) but are designed to contains standard controls like a dialog.
0
jkrCommented:
Handle 'WM_GETMINMAXINFO' by overriding 'OnGetMinMaxInfo()', e.g.


void CMyView::OnGetMinMaxInfo(MINMAXINFO* lpmmi)
{
     lpmmi->ptMaxSize.x = 320;
     lpmmi->ptMaxSize.y = 240;
     lpmmi->ptMaxTrackSize.x = 320;
     lpmmi->ptMaxTrackSize.y = 240;
     lpmmi->ptMinTrackSize.x = 240;
     lpmmi->ptMinTrackSize.y = 240;
}

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.