Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - MDI children always maximized?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

MDI children always maximized?

 Post Reply Post Reply
Author
Message
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Topic: MDI children always maximized?
    Posted: 03 March 2007 at 1:26am
Hi,
 
How do I make sure that all MDI children inside a
CXTPTabClientWnd are always maximized - no matter what?
 
I have tried to override both PreCreateWindow and ActivateFrame:
 
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
    cs.style &= ~(WS_MINIMIZEBOX | WS_MAXIMIZEBOX);
    if (!CMDIChildWnd::PreCreateWindow(cs))
        return FALSE;
    return TRUE;
}
void CChildFrame::ActivateFrame(int nCmdShow /* = -1 */)
{
    nCmdShow = SW_SHOWMAXIMIZED;
    CMDIChildWnd::ActivateFrame(nCmdShow);
}
 
This works until the user preses the close button of one of the MDI frames. Then the remaining children are restored!
 
Any ideas? Thanks.
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 03 March 2007 at 2:19am
After reading https://forum.codejock.com/forum_posts.asp?TID=226 I found the optimal solution:
 
Just like Oleg writes, do this in CMainFrame::OnCreate():
pCommandBars->GetMenuBar()->SetFlags(xtpFlagHideMinimizeBox | xtpFlagHideMaximizeBox);
 
Then add this in each child frame:
 
void CChildFrame::ActivateFrame(int nCmdShow /* = -1 */)
{
    nCmdShow = SW_SHOWMAXIMIZED;
    CMDIChildWnd::ActivateFrame(nCmdShow);
}
 
Lol... it's always like this. You google like a freak and you find nothing. Then you post the question somewhere, and in the next couple of minutes you stumble upon the solution.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.188 seconds.