Learn how to a build a cloud-first strategyRegister Now


MoveWindow( ) does not really change the size of the window.... what actually works?

Posted on 2009-02-23
Medium Priority
Last Modified: 2013-11-20

I am having a problem trying to increase the height of my dialog box.  I am using MoveWIndow()  to change the bottom dimension of my dialog box, but it doesn't make it longer.  I can however make it shorter.  Below is some code that I am using to change the size of my dialog.  I need help as to how to increase the height of my dialog as I am using it to report various data of text which can be short or long in info. The dialog box code below show's me increasing the WRect.bottom parameter of the CRect, yet I don't see any difference from the original dialog box size.
// get view dialog box dimensions
	CRect WRect;
	iViewLeft = WRect.left;
	iViewTop = WRect.top;
	iViewBottom = WRect.bottom;
	iViewRight = WRect.right;
	ViewWidth = iViewRight - iViewLeft;  // original dialog width
	ViewHeight = iViewBottom - iViewTop; // original dialog height
    ViewMid = iViewLeft + ViewWidth/2;     // half width
	// move to right of screen & shrink height and expand width to expose only the vertical scroll bars
	WRect.bottom = iViewBottom + 1200;  // make it longer
	WRect.right = pTheApp->iRightDim + ViewWidth;
	WRect.left = pTheApp->iRightDim;  // rightmost dim to shift dialog to right half of screen
	this->MoveWindow(&WRect);  // resize

Open in new window

Question by:JPM2002
  • 3
  • 2
LVL 45

Expert Comment

ID: 23718891
I tihnk that code should work - quick look and don't see any obvious error.  (Do you have code elsewhere such as an OnSize handler ?).

put a breakpoint and check the values of WRect when you obtain it and the use it in MoveWindow
eg. on lines 5 and 24.

iViewLeft = WRect.left;


Author Comment

ID: 23718962
this code works like I explained above.  It moves the dialog box to the right, but trying to lengthen the bottom portion of the dialog does not work. I have stepped thru this code and though the WRect.bottom is greater the size(total height) does not change visibly on the screen.
LVL 19

Expert Comment

ID: 23719101
Have you an handler function for WM_GETMINMAXINFO limiting the height?
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.

LVL 45

Accepted Solution

AndyAinscow earned 1500 total points
ID: 23719102
>>I have stepped thru this code and though the WRect.bottom is greater the size(total height) does not change visibly on the screen

That is why I asked if there is other code such as an OnSize handler that could be interfering.

As an experiment change
WRect.bottom = iViewBottom + 1200;  // make it longer
WRect.bottom = iViewBottom + 200;  // note - not so much larger

Does the height change now work?


Author Comment

ID: 23719138
I've tried small 200, 300, and as well as large excursions 1200, 1500 ... no change from original size even though the WRect.bottom value says otherwise.  I don't have OnSIze handler also.

Author Closing Comment

ID: 31550395
Its okay now I found out how to solve my problem.  I do have an OnSize handler, but it calling functions that kept the windows the default size. Thanks for alerting me to the OnSize as a search for that lead me to find the problem.  I will award you par.tial number of points for that

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
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.
Integration Management Part 2
Suggested Courses

810 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