Solved

resizing an MDI parent window

Posted on 1997-07-09
2
466 Views
Last Modified: 2013-11-20
I need to resize the parent window in an MDI app, after
the program has started, so I can't override
PreCreateWindow. I'm displaying an image in the child
window, so I need to wait until I have loaded it to
resize the parent to be exactly the size of the image; is
there a command to resize the main frame?
0
Comment
Question by:nicholso
2 Comments
 
LVL 1

Accepted Solution

by:
tser earned 50 total points
ID: 1302517
Try calling the main frame window's member function:
MoveWindow() or SetWindowPos()

You may have to take consideration on the border width of the frame window.
0
 

Expert Comment

by:mueller
ID: 1302518
First obtain a pointer to the child's parent window before attempting to manipulate its size.  Then resize that window as necessary.  If you need to calculate the dimensions of the child window and set the dimensions of the parent window to that, use GetWindowRect() for the child window and set accordingly for the parent.  Here is an example:

// obtain a pointer to the child's parent window
CWnd *pWndParent = GetParent();

// now get size of the current child window (including borders)
CRect rcChildRect;
GetWindowRect( &rcChildRect );

// next set the size of the parent window to that of the child
// NOTE:  the TRUE parameter forces a redraw on the parent
// window
pWndParent->MoveWindow( &rcChildRect, TRUE );

// finally update the parent window
pWndParent->UpdateWindow();


0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to calculate times for developing software? 8 65
Separate files macro - Errors on larger data set 18 65
Detect file exist or not 3 132
Not needed 13 94
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: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

920 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now