cs.style |= WS_MAXIMIZE;
in CChildFrame:PreCreateWindow(), but this does not work.
Thanks in advance for helps.
--
Jimmy Han
Jimmy Han wrote in message <34CFB8...@cisco.com>...
>In a MDI app, how to make the initial view maximized? Take the sample
>scribble, I tried adding
>
>cs.style |= WS_MAXIMIZE;
>
>in CChildFrame:PreCreateWindow(), but this does not work.
How can I create an application that is initially maximized?
For new applications, this can be done with AppWizard during Step 4. During
Step 4, choose Advanced..., and then select the Main Frame tab. Check the
Maximized option.
For an MDI application, in the CWinApp::InitInstance() function, set
CWinApp::m_nCmdShow to SW_SHOWMAXIMIZED before calling
pMainFrame->ShowWindow(m_nCmdShow). In an application generated by
AppWizard, the code is as follows:
// create main MDI Frame window
CMainFrame* pMainFrame = new CMainFrame;
if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
return FALSE;
m_nCmdShow = SW_SHOWMAXIMIZED; // ADD THIS LINE!
pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->UpdateWindow();
m_pMainWnd = pMainFrame;
In an SDI application, in the CWinApp::InitInstance() function, set
CWinApp::m_nCmdShow to SW_SHOWMAXIMIZED before calling OnFileNew().For
example, in an application generated by AppWizard, the code is as follows:
m_nCmdShow = SW_SHOWMAXIMIZED;
//
// create a new (empty) document
OnFileNew();
MSVC Knowledge Base, 6/4/95
-
Jimmy Han
CMyView::OnInitialUpdate()
{
CView::OnInitialUpdate();
// Other initialisation
...
// Check to see if this is the first (only) view
if (IsOnlyView())
{
// Maximize the CMDIChildWnd object containing the view,
// rather than the view itself
GetParent()->ShowWindow(SW_SHOWMAXIMIZED);
}
}
BOOL CMyView::IsOnlyView()
{
int iOtherViews = 0;
CMyDoc* pDoc = GetDocument();
CDocTemplate* pTemplate = pDoc->GetDocTemplate();
POSITION pos = pTemplate->GetFirstDocPosition();
while(pos)
{
CDocument* pDoc = pTemp->GetNextDoc(posDoc);
POSITION posView = pDoc->GetFirstViewPosition();
while (posView)
{
CView* pView = pDoc->GetNextView(posView);
if (pView != this)
{
iOtherViews++;
}
}
}
return (iOtherViews == 0);
}
--
Pete
p.co...@XXXacecad.demon.co.uk
(remove the XXX to e-mail)
Jimmy Han <jh...@cisco.com> wrote in article <34CFB8...@cisco.com>...
> In a MDI app, how to make the initial view maximized? Take the sample
> scribble, I tried adding
>
> cs.style |= WS_MAXIMIZE;
>
> in CChildFrame:PreCreateWindow(), but this does not work.
>