dynamically scroll/change size of a dialog

Posted on 2004-11-22
Last Modified: 2013-11-20
I have some edit controls I've added at run-time to a modal dialog.

Since I don't know how many I'm going to need prior to run-time, I need a way to either resize the dialog or allow it to be scrolled.

I've tried using the following code (in my class based on the CDialog class) to re-size the HEIGHT of the dialog:

SetWindowPos(&wndTop, rect2.left,, rect2.right, rect2.bottom + y,SWP_NOZORDER | SWP_SHOWWINDOW );

This doesn't work right though... it keeps expanding the WIDTH of the dialog. If I use GetClientRect, it doesn't work either. Then the WIDTH is shrinking.

What am I missing?
Question by:JoyBurke
    LVL 8

    Accepted Solution

         CRect rect2;
          SetWindowPos(&wndTop, rect2.left,, rect2.Width(), rect2.Height()+50,SWP_NOZORDER | SWP_SHOWWINDOW );
    LVL 8

    Expert Comment

    As you can probably infer from my example, you need to specify the height (bottom - top) you want the window to be rather then the location of the bottom coordinate.

    LVL 55

    Expert Comment

    by:Jaime Olivares

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Suggested Solutions

    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: 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. …
    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.
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    761 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

    9 Experts available now in Live!

    Get 1:1 Help Now