CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 1999
    Posts
    20

    How can I maximize the first View at my MDI app

    Hi!

    I need to make the FIRST VIEW in an MDI
    app the entire size of the client area of
    the main frame window, but not *MAXIMIZED*
    (i.e. - like I dragged it to the right-bottom
    corner...)

    Regards,
    Eyal



  2. #2
    Join Date
    Apr 1999
    Posts
    383

    Re: How can I maximize the first View at my MDI app

    Here's how I do it. Insert the code between the rows of asterisks into your CWinApp-derived class's InitInstance() function, just after the call to ProcessShellCommand() that creates the first child window. I use NegotiateBorderSpace() to calculate the space occupied by the toolbar and status bar, since GetClientWindow() doesn't:


    BOOL CMyApp::InitInstance()
    {
    ...
    if (!ProcessShellCommand(cmdInfo))
    return FALSE;
    //**************************************************
    CFrameWnd* pChildFrame = pMainFrame->GetActiveFrame();
    CRect rectBorder;
    pMainFrame->NegotiateBorderSpace(CFrameWnd::borderGet, &rectBorder);
    CRect clientRect(0,0,0,0);
    clientRect.right = rectBorder.Width() - GetSystemMetrics(SM_CXSIZEFRAME);
    clientRect.bottom = rectBorder.Height() - GetSystemMetrics(SM_CYSIZEFRAME);
    pChildFrame->MoveWindow(&clientRect);
    //**************************************************
    ...
    }




    Dave




  3. #3
    Join Date
    May 1999
    Posts
    20

    Re: How can I maximize the first View at my MDI app

    Thanks, dave!

    In order for it to work properly,
    I put the code between
    ShowWindow() and UpdateWindow()!



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured