Solved

resizing an MDI parent window

Posted on 1997-07-09
2
477 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
[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 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

 Database Backup and Recovery Best Practices

Join Percona’s, Architect, Manjot Singh as he presents Database Backup and Recovery Best Practices (with a Focus on MySQL) on Thursday, July 27, 2017 at 11:00 am PDT / 2:00 pm EDT (UTC-7). In the case of a failure, do you know how long it will take to restore your database?

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

626 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