CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2016
    Posts
    3

    Post In mfc MDI project the onfilenew restores the existing fullscreen MDI child.

    Dear All,
    I have a MFC MDI project where in on start a maximised MDI child window is created. Later the user can create more MDI children. It is observed that when more children (12 of them) are created by OnFileNew() the existing maximized MDI child is restored and briefly we see the restored mdi child window on screen.
    Is there a way to stop the restoring of the existing maximized MDI child window.
    I have got screenshot which shows the problem.
    Name:  resized.jpg
Views: 479
Size:  19.5 KB
    Thanks and Regards,
    Rakesh

    What I have tried:

    I have tried creating the new children in hide mode (SW_HIDE). It didnt work. I tried creating the new children in very small size and outside the mdi main frame client area.
    I have tried putting the existing window on top
    (
    Hide Copy Code
    pAnimView->SetWindowPos(&CWnd::wndTop, 0, 0, 0, 0,SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
    )
    and then making calls to OnFileNew();
    Nothing worked.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: In mfc MDI project the onfilenew restores the existing fullscreen MDI child.

    Could you explain a bit more carefully the "observed" difference in creation of the 12-th and, say, 10-th child?
    Victor Nijegorodov

  3. #3
    Join Date
    Jul 2016
    Posts
    3

    Re: In mfc MDI project the onfilenew restores the existing fullscreen MDI child.

    Thanks VictorN
    There is no difference in the 10th and 12th call. The window shows in restored size till all OnFileNew gets processed and then the unless it is maximized it remains in restored size. The attached screen shot shows the restored view of the window.

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: In mfc MDI project the onfilenew restores the existing fullscreen MDI child.

    Could you post a test project that can reproduce the problem you observed?
    Victor Nijegorodov

  5. #5
    Join Date
    Jul 2016
    Posts
    3

    Re: In mfc MDI project the onfilenew restores the existing fullscreen MDI child.

    Quote Originally Posted by VictorN View Post
    Could you post a test project that can reproduce the problem you observed?
    Thanks Victor,
    Will create a test project and upload by tomorrow.
    Regards,
    Rakesh

  6. #6
    Join Date
    Jan 2009
    Posts
    399

    Re: In mfc MDI project the onfilenew restores the existing fullscreen MDI child.

    You can override:

    Code:
    void CChildFrame::ActivateFrame(int nCmdShow) 
    {
    	// TODO: Add your specialized code here and/or call the base class
    
    	if(your_condition)
    		nCmdShow = SW_SHOWMAXIMIZED /*SW_RESTORED or whatever*/;
    
    	CMDIChildWndEx::ActivateFrame(nCmdShow);
    }
    and setup the childframe state whatever you want.

Tags for this Thread

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