Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to Maximize MDI Child View on startup?

Posted on 1997-04-27
2
Medium Priority
?
509 Views
Last Modified: 2013-11-20
I have an MDI app and I would like to know how to display the initial CView  in a maximized state on startup or on opening a new vew.  I have tried Wingo's tip in his FAQ but this did not seem to help.  I know how to maximize the CFrameWnd but how do I maximize the MDI child views?
0
Comment
Question by:duhrbroc
2 Comments
 
LVL 1

Accepted Solution

by:
xbwen earned 100 total points
ID: 1301206
  Add MDIMaximize() in your CChildFrame::OnCreate() such as:  

 int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
 {
      if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1)
            return -1;
      
      // TODO: Add your specialized creation code here
      this->MDIMaximize();

      return 0;
 }

0
 

Author Comment

by:duhrbroc
ID: 1301207
Dear xbwen:

Thanks for your info.  As implemented, your code caused an assertion.  Below is a method that works.  Thanks very much.  Your solution is elegant and simple.  Well done.

BOOL CChildFrame::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CMDIFrameWnd* pParentWnd, CCreateContext* pContext)
{
      // TODO: Add your specialized code here and/or call the base class
      BOOL      bRetval;
      bRetval = CMDIChildWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, pContext);
      this->MDIMaximize();
      return bRetval;
}

0

Featured Post

Technology Partners: 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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month9 days, 2 hours left to enroll

877 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