Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CDialog initial size.

426 views
Skip to first unread message

Beamer

unread,
Feb 14, 2009, 4:41:47 PM2/14/09
to
I have a CDialog derived class that has a resizing border. I allow the
operator to size the dialog. When the dialog first opens I usually want
its initial size to be the size that it is designed as in the dialog
resource.

However, sometimes I want the dialog to be larger when it first opens.
My plan is to pass initial size data into the dialog in the dialog's
constructor. I'd then save those values in the class's data. Then in the
OnInitDialog method (or maybe somewhere else) I'd do "something" to
adjust the dialog's size.

What do I do to make this happen. What do I call (and where) to adjust
the initial size of the window?

David Wilkinson

unread,
Feb 14, 2009, 5:16:25 PM2/14/09
to

Use MoveWindow() or SetWindowPos().

--
David Wilkinson
Visual C++ MVP

David Lowndes

unread,
Feb 14, 2009, 6:42:34 PM2/14/09
to
>However, sometimes I want the dialog to be larger when it first opens.
>My plan is to pass initial size data into the dialog in the dialog's
>constructor. I'd then save those values in the class's data. Then in the
> OnInitDialog method (or maybe somewhere else) I'd do "something" to
>adjust the dialog's size.
>
>What do I do to make this happen. What do I call (and where) to adjust
>the initial size of the window?

As David's mentioned, use MoveWindow or SetWindowPos. You can call
them from your dialog's OnInitDialog handler as you hoped.

Dave

David Webber

unread,
Feb 15, 2009, 11:19:52 AM2/15/09
to

"Beamer" <Bea...@email.com> wrote in message
news:nSGll.1982$Lr6...@flpi143.ffdc.sbc.com...

Let me add bells and whistles to what the others have said:

If you want to preserve te state between runs of the program, you can save
the size in the registry, and use it to construct a WINDOWPLACEMENT
structure, which you can impose with the SetWindowPlacement() API (and
doing it in OnInitDialog() is the right place).

Dave
--
David Webber
Author of 'Mozart the Music Processor'
http://www.mozart.co.uk
For discussion/support see
http://www.mozart.co.uk/mozartists/mailinglist.htm

Beamer

unread,
Feb 15, 2009, 9:49:21 PM2/15/09
to
Thank you everyone.
0 new messages