JohnL
Mon Sep 13 11:26:26 CDT 2004
Thank you very much, Sigurd,
I tried the codes and you are absolutely right.
John
"Sigurd Stenersen" <sigurds@utvikling.com> wrote in message
news:elM$pU9lEHA.3896@TK2MSFTNGP15.phx.gbl...
> JohnL wrote:
> > I solved the problem, but only partly. Since if I call SetWindowPos
> > function directly inside of ::OnSize(), the software will corrupt
> > every time. Instead, to solve this problem, I have to set a variable
> > bEnableResize, and this variable is enabled in OnInitDialog(). Before
> > the variable is enabled, SetWindowPos function will not be called.
>
> You don't give enough details - what do you mean, "corrupt" ?
>
> It seems likely that your window (the dialog) receives an OnSize() when it
> is created, before the controls are created. So GetDlgItem() will
probably
> return NULL until you receive the OnInitDialog(). Thus, there is no need
> for a state variable - just check the GetDlgItem() return value before you
> use it...
>
>
> Also, the following :
>
> > RECT * lpRect = new RECT();
> > GetClientRect (lpRect);
> > GetDlgItem (IDC_IPAQ) ->SetWindowPos ( &wndBottom, lpRect->left,
> > lpRect->top, cx, cy, SWP_SHOWWINDOW);
>
> ...is identical to :
>
> GetDlgItem (IDC_IPAQ) ->SetWindowPos ( &wndBottom, 0,
> 0, cx, cy, SWP_SHOWWINDOW);
>
>
> --
>
>
> Sigurd
>
http://utvikling.com
>
>