Solved

How to set size of MDI child window?

Posted on 1999-01-09
1
250 Views
Last Modified: 2013-11-20
I have a MDI application and wish to fix the size and position of a child window. I found that I need to use SetWindowPos but do not know when I should call it. Please advice. Thanks.
0
Comment
Question by:lim_cheryl
1 Comment
 
LVL 2

Accepted Solution

by:
jrmcg earned 50 total points
ID: 1327433
Use the PreCreateWindow function inside the ChildFrm.cpp file
could be MainFrm.cpp
or YouAppChild.cpp

This is the class that creates your frame window.

your function will look like this:

BOOL CMyProgChild::PreCreateWindow(CREATESTRUCT& cs)
{
  int x,y,w,h;
 
  x = TopValue;
  y = LeftValue;
  w = WidthValue;
  h = HeightValue;
  cs.x  = x;
  cs.y  = y;
  cs.cx = w;
  cs.cy = h;
 
  return CMDIChildWnd::PreCreateWindow(cs);
}
This will set the size and position of the window when you open the window.

Hope this helps, if you need more let me know..

J.R.
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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

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

16 Experts available now in Live!

Get 1:1 Help Now