How to make init view maximized 
Author Message
 How to make init view maximized

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.

Thanks in advance for helps.
--
Jimmy Han



Sun, 16 Jul 2000 03:00:00 GMT  
 How to make init view maximized

Quote:

>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


Sun, 16 Jul 2000 03:00:00 GMT  
 How to make init view maximized

I want to know how to make the document view window, that is the child
window of the main frame, to appear initially maximized, not the
application. The reply did not answer my question.

-
Jimmy Han

Quote:


> >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



Sun, 16 Jul 2000 03:00:00 GMT  
 How to make init view maximized

Try something like this...

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);
        }

Quote:
}

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);

Quote:
}

--

Pete

(remove the XXX to e-mail)


Quote:
> 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.

> Thanks in advance for helps.
> --
> Jimmy Han



Mon, 17 Jul 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Maximize, maximize and more maximize...

2. making ScrollView scrollpos persistant over Maximize/Restore

3. Making an MDI child window initially maximized

4. Keeping Main View window invisible during init

5. maximize application and default view

6. Mulit-Doc/View - MAXIMIZE Child Window

7. Maximize MDI view

8. How do I make my initial view maximized.

9. Maximizing View when created

10. displaying view withought maximizing it

11. Maximizing Views

12. Maximizing Form View

 

 
Powered by phpBB® Forum Software