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
    Posts
    258

    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
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: disabling maximize option in SDI window

    In function PreCreateWindow remove the WS_MAXIMIZE and WS_MAXIMIZEBOX.

    Code:
    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
    Location
    Indore, India
    Posts
    1,046

    Re: disabling maximize option in SDI window

    Hello,

    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.

    Code:
    int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
    {
    	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
    		return -1;
    	ModifyStyle(WS_MAXIMIZEBOX, 0);
    	...
    }
    Regards,
    Pravin.
    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
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center