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

Posted on 2009-02-23
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 =;

	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
    LVL 43

    Expert Comment

    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

    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

    Have you an handler function for WM_GETMINMAXINFO limiting the height?
    LVL 43

    Accepted Solution

    >>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

    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

    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    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…
    Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
    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.
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    779 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

    11 Experts available now in Live!

    Get 1:1 Help Now