Solved

Maximizing a MDI View

Posted on 1997-08-28
3
349 Views
Last Modified: 2013-11-20
How can I maximize a document view in a MDI app when I create a new doc, or when I open a doc
0
Comment
Question by:onyxmedia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 3

Expert Comment

by:stefanr
ID: 1305061
You could use something like this, which I have taken from a test app I made to create the initial empty document with a maximized child frame in InitInstance():

...
      CMultiDocTemplate* pDocTemplate;
      pDocTemplate = new CMultiDocTemplate(
            IDR_MDITYPE,
            RUNTIME_CLASS(CMDIDoc),
            RUNTIME_CLASS(CChildFrame), // custom MDI child frame
            RUNTIME_CLASS(CMDIView));
      AddDocTemplate(pDocTemplate);

      // create main MDI Frame window
      CMainFrame* pMainFrame = new CMainFrame;
      if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
            return FALSE;
      m_pMainWnd = pMainFrame;

      // Parse command line for standard shell commands, DDE, file open
      CCommandLineInfo cmdInfo;
      ParseCommandLine(cmdInfo);

      // Dispatch commands specified on the command line
   if (cmdInfo.m_nShellCommand != CCommandLineInfo::FileNew)
   {
         if (!ProcessShellCommand(cmdInfo))
               return FALSE;
   }
   else
   {
      CDocument* pDoc = pDocTemplate->CreateNewDocument();
      CFrameWnd* pFrame = pDocTemplate->CreateNewFrame(pDoc, NULL);
      pMainFrame->MDIMaximize(pFrame);
      pFrame->InitialUpdateFrame(pDoc, TRUE);
   }

      // The main window has been initialized, so show and update it.
      pMainFrame->ShowWindow(m_nCmdShow);
      pMainFrame->UpdateWindow();

      return TRUE;
}

0
 

Author Comment

by:onyxmedia
ID: 1305062
Sorry, that doesn't work ...
Opened 3 windows ?!?!?
And debug assertion fails !

0
 
LVL 3

Accepted Solution

by:
stefanr earned 10 total points
ID: 1305063
Here's another alternative:

Override the virtual function ActivateFrame in your derived CMDIChildWnd as this:

void CChildFrame::ActivateFrame(int nCmdShow)
{
   CMDIFrameWnd* pMainFrame = (CMDIFrameWnd*) ::AfxGetMainWnd();
   pMainFrame->MDIMaximize(this);
      
   CMDIChildWnd::ActivateFrame(nCmdShow);
}

Less flexible, but it should work for you.

/Stefan
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
fizzArray2 challenge 1 110
Use of condition with 'serial' in ansible 2 100
ERP and the other system process verification 5 24
Message not shown 5 103
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question