Setting size of dialog 
Author Message
 Setting size of dialog

Hi everybody!
I have problem with a modal dialog. What I want to do is simple, I would
like the dialog be create in a size decided by me. I have tried the
following:

//In the parent dialog
CInfoBar infoBar;
 infoBar.m_rectArea = rect;    // rect is the size I want the new dialog to
have
 infoBar.DoModal();

// In the dialog I want to resize. I have tried to put this code in
OnCreate, OnInitialUpdate and OnShowWindow. OnCreate isn't called at all,
the othe r two funtions are called but nothing happends
SetWindowPos(this,
                 m_rectArea.left,
                 m_rectArea.top,
                 m_rectArea.Width(),
                 m_rectArea.Height(),
                 SWP_SHOWWINDOW);

The dialog is created for a few milliseconds in my preferd size, then it is
maximized. What am I doing wrong?

Regards,
Markus



Sat, 05 Jun 2004 00:01:18 GMT  
 Setting size of dialog
Don't use "this" in SetWindowPos arg #1. It needs an HWND.
I'm guessing that CInfoBar is derived from CWnd, and CWnd
has a data member called m_hWnd. Try this:

SetWindowPos(infoBar.m_hWnd, x, y, width, height,
SWP_SHOWWINDOW);

replace x, y, width and height with your real values.

Quote:
>-----Original Message-----
>Hi everybody!
>I have problem with a modal dialog. What I want to do is
simple, I would
>like the dialog be create in a size decided by me. I have
tried the
>following:

>//In the parent dialog
>CInfoBar infoBar;
> infoBar.m_rectArea = rect;    // rect is the size I want
the new dialog to
>have
> infoBar.DoModal();

>// In the dialog I want to resize. I have tried to put
this code in
>OnCreate, OnInitialUpdate and OnShowWindow. OnCreate

isn't called at all,
Quote:
>the othe r two funtions are called but nothing happends
>SetWindowPos(this,
>                 m_rectArea.left,
>                 m_rectArea.top,
>                 m_rectArea.Width(),
>                 m_rectArea.Height(),
>                 SWP_SHOWWINDOW);

>The dialog is created for a few milliseconds in my

preferd size, then it is

- Show quoted text -

Quote:
>maximized. What am I doing wrong?

>Regards,
>Markus

>.



Sat, 05 Jun 2004 00:49:59 GMT  
 Setting size of dialog
It didn't work. The first arg. to SetWindowPos must be a CWnd*. The compiler
dosn't like the hwnd.

Markus


Quote:
> Don't use "this" in SetWindowPos arg #1. It needs an HWND.
> I'm guessing that CInfoBar is derived from CWnd, and CWnd
> has a data member called m_hWnd. Try this:

> SetWindowPos(infoBar.m_hWnd, x, y, width, height,
> SWP_SHOWWINDOW);

> replace x, y, width and height with your real values.

> >-----Original Message-----
> >Hi everybody!
> >I have problem with a modal dialog. What I want to do is
> simple, I would
> >like the dialog be create in a size decided by me. I have
> tried the
> >following:

> >//In the parent dialog
> >CInfoBar infoBar;
> > infoBar.m_rectArea = rect;    // rect is the size I want
> the new dialog to
> >have
> > infoBar.DoModal();

> >// In the dialog I want to resize. I have tried to put
> this code in
> >OnCreate, OnInitialUpdate and OnShowWindow. OnCreate
> isn't called at all,
> >the othe r two funtions are called but nothing happends
> >SetWindowPos(this,
> >                 m_rectArea.left,
> >                 m_rectArea.top,
> >                 m_rectArea.Width(),
> >                 m_rectArea.Height(),
> >                 SWP_SHOWWINDOW);

> >The dialog is created for a few milliseconds in my
> preferd size, then it is
> >maximized. What am I doing wrong?

> >Regards,
> >Markus

> >.



Sat, 05 Jun 2004 01:13:47 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. dialog size in evc++ dialog editor not the same as size in pixels on device

2. Bug in mfc dialog on laptops, when setting absolute position and size

3. OnGetMinMaxInfo - how to set minimum size for dialog

4. Manually set dialog size

5. Question about how to set the size of a Dialog box in VC

6. Dialog Resources and different Font size settings.

7. How to set different font sizes for Dialog box properties

8. Manually setting dialog font size

9. Setting window size and cursor size

10. Setting Frame Size with Window Size

11. Setting Frame Size with Window Size

12. How to set control size to view size

 

 
Powered by phpBB® Forum Software