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.
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

alb66Connect With a Mentor Commented:
Ovveride PreCreateWindow() in your mainframe window:

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

      // fix the dimension = 640; = 480;

      // disable sizing &= ~WS_THICKFRAME;

      return TRUE;
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.
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

All Courses

From novice to tech pro — start learning today.