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

x
?
Solved

How to set size of MDI child window?

Posted on 1999-01-09
1
Medium Priority
?
266 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 100 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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…
In this post we will learn different types of Android Layout and some basics of an Android App.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
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.
Suggested Courses

916 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