CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Guest

    Initially maximize window

    Hi,
    I know how to maximize the main window i.e using W_SHOWMAXIMIZED
    But how can I maximize the child window initially?

    Thank you


  2. #2
    Guest

    Re: Initially maximize window

    You can add the window style WS_MAXIMIZE to the child frame's pre-create window function, as follows:

    BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
    {
    // Maximize the child window.
    cs.style |= WS_MAXIMIZE | WS_VISIBLE;

    return (CMDIChildWnd::PreCreateWindow(cs));
    }



    I hope this helps,

    John G.



  3. #3
    Join Date
    May 2009
    Location
    Bengaluru, India
    Posts
    460

    Re: Initially maximize window

    I am trying the above method but still my window is not getting displayed in the maximised mode

  4. #4
    Join Date
    Jan 2009
    Posts
    399

    Re: Initially maximize window

    In your CChildFrame header:
    Code:
    	protected:
    	virtual void ActivateFrame(int nCmdShow = -1);
    implementation:
    Code:
    void CChildFrame::ActivateFrame(int nCmdShow)
    {
    	// TODO: Add your specialized code here and/or call the base class
    
    	if (-1 == nCmdShow && NULL == GetNextWindow() && NULL == GetNextWindow(GW_HWNDPREV))
    		nCmdShow = SW_SHOWMAXIMIZED;
    
    	CMDIChildWnd::ActivateFrame(nCmdShow);
    }

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