MDIChild Windows
3 messages in this thread
How do I create MDI Child Windows that are initially maximized? I have derived
a new MDIChildWnd class and have a PreCreateWindow function but I'm not sure
what I need to do there. Would appreciate anyone's help,
Thanks,
Jeff
<< I have derived a new MDIChildWnd class and have a PreCreateWindow function
but I'm not sure what I need to do there. >>
This should be straightforward (!) :
BOOL CMyMDIChildWnd::PreCreateWindow( CREATESTRUCT& cs )
{
cs.style |= WS_MAXIMIZE;
return CMDIChildWnd::PreCreateWindow( cs );
} // PreCreateWindow
Make sure to register your derived CMyMDIChildWnd class when you do the
AddDocTemplate in your app's InitInstance().
I hope this helps, SLH.
<<<< I have derived a new MDIChildWnd class and have a PreCreateWindow function
but I'm not sure what I need to do there. >>
This should be straightforward (!) :
BOOL CMyMDIChildWnd::PreCreateWindow( CREATESTRUCT& cs ) {
cs.style |= WS_MAXIMIZE;
return CMDIChildWnd::PreCreateWindow( cs ); } // PreCreateWindow>>
PMFJI, but this is *not* the way to get maximized MDI children. The problem is
a defect in the MDI management code inside Windows itself; you will end up with
various menu problems if you do it this way.
At the moment, the safest way to get maximized MDI children is to
1) Use SetRedraw(FALSE) to turn off updating of either the main frame window
or the MDI client window.
2) Create the new MDI child normally.
3) Maximize the new child.
4) Turn updating back on with SetRedraw().
5) Invalidate whatever needs to be repainted.