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

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 605
  • Last Modified:

How to set size of MDI child window?

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
lim_cheryl
Asked:
lim_cheryl
1 Solution
 
PavelYCommented:
Hi,

Use SetWindowPos whenever you want to change the size (or position) when the window exists.
If you want to change size or position before the window is created, override CWnd::PreCreateWindow, and chage the x,y,cx,cy members of the CREATESTRUCT appropriately.

0
 
plarocheCommented:
1) SetWindowPos as previously said can be used in OnCreate in your window.

2) To fix the size you need to handle WM_GETMINMAXINFO. This override will allow you to prevent the sizing beyond a certain point. Other wise try handling OnMove and OnSize, without calling the base class.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now