disabling maximize option in SDI window
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: disabling maximize option in SDI window

  1. #1
    Join Date
    Feb 2007

    disabling maximize option in SDI window

    Hi all,

    I have made a sdi application. i want that my sdi application window should always remain in restore form it should never get maximized. How to disable maximize window option....

    thanks in advance

  2. #2
    Join Date
    Oct 2002
    Timisoara, Romania

    Re: disabling maximize option in SDI window

    In function PreCreateWindow remove the WS_MAXIMIZE and WS_MAXIMIZEBOX.

    BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
      if( !CMDIFrameWnd::PreCreateWindow(cs) )
    	return FALSE;
      // TODO: Modify the Window class or styles here by modifying
      //  the CREATESTRUCT cs
      cs.style &= (~WS_MAXIMIZE & ~WS_MAXIMIZEBOX);
      return TRUE;
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  3. #3
    Join Date
    Feb 2000
    Indore, India

    Re: disabling maximize option in SDI window


    You can disable maximize button by removing the corresponding style after the window is created. In OnCreate function of CMainFrame class, add the line as shown below to remove the style.

    int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
    	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
    		return -1;
    	ModifyStyle(WS_MAXIMIZEBOX, 0);
    Let me know if I have helped by rating this post

    Recent FAQs

    Drag an image
    Area of a window exposed on desktop
    Display rotated bitmap

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This a Codeguru.com survey!

On-Demand Webinars (sponsored)