none
create view with no system buttons RRS feed

  • Question

  • In my MFC multi-doc program, I create several documents and the corresponding views. I would like the views to be created with no maximize or minimize buttons. I've found several responses that tell how to create the frame without these buttons but haven't found any that address creating a document/view without these buttons.  Can it be done?  Thanks.
    Tuesday, October 9, 2018 2:25 PM

Answers

  • In my MFC multi-doc program, I create several documents and the corresponding views. I would like the views to be created with no maximize or minimize buttons. I've found several responses that tell how to create the frame without these buttons but haven't found any that address creating a document/view without these buttons.  Can it be done?  Thanks.

    See Changing the Styles of a Window Created by MFC

    For example --

    BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
    {
    	// TODO: Modify the Window class or styles here by modifying the CREATESTRUCT cs
    
    	cs.style &= ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX);
    
    	if( !CMDIChildWndEx::PreCreateWindow(cs) )
    		return FALSE;
    
    	return TRUE;
    }
    

    • Edited by RLWA32 Tuesday, October 9, 2018 2:38 PM added example
    • Proposed as answer by Pintu Shukla Tuesday, October 9, 2018 2:43 PM
    • Marked as answer by lfvoydfv Tuesday, October 9, 2018 2:55 PM
    Tuesday, October 9, 2018 2:29 PM

All replies

  • In my MFC multi-doc program, I create several documents and the corresponding views. I would like the views to be created with no maximize or minimize buttons. I've found several responses that tell how to create the frame without these buttons but haven't found any that address creating a document/view without these buttons.  Can it be done?  Thanks.

    See Changing the Styles of a Window Created by MFC

    For example --

    BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
    {
    	// TODO: Modify the Window class or styles here by modifying the CREATESTRUCT cs
    
    	cs.style &= ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX);
    
    	if( !CMDIChildWndEx::PreCreateWindow(cs) )
    		return FALSE;
    
    	return TRUE;
    }
    

    • Edited by RLWA32 Tuesday, October 9, 2018 2:38 PM added example
    • Proposed as answer by Pintu Shukla Tuesday, October 9, 2018 2:43 PM
    • Marked as answer by lfvoydfv Tuesday, October 9, 2018 2:55 PM
    Tuesday, October 9, 2018 2:29 PM
  • Ah, yes, that looks familiar.  I should have known that.  Thanks!
    Tuesday, October 9, 2018 2:56 PM