CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1
  1. #1
    Join Date
    Sep 2000
    Location
    Indianapolis
    Posts
    6,754

    MFC Dialog: How to add a minimize/maximize button into your dialog?

    Q: How to add a minimize/maximize button into your dialog?

    A:
    • At design time: use the dialogs properties in the resource editor.
    • At runtime: override the 'OnCreate()' function like this:


    Code:
    int CYourDialog::OnCreate(LPCREATESTRUCT lpCreateStruct)
    {
      if(CDialog::OnCreate(lpCreateStruct) == -1)
        return -1;
    
      // TODO: Add your specialized creation code here
      SetWindowLong(this->m_hWnd,
                    GWL_STYLE,
                    GetWindowLong(this->m_hWnd, GWL_STYLE) | WS_MINIMIZEBOX | WS_MAXIMIZEBOX);
    
      return 0;
    }

    Last edited by Andreas Masur; July 24th, 2005 at 04:09 PM.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured