1.tutorial sadi:

At this point, the dialog box and its child window controls are created by Windows. Your window procedure will receive WM_CREATE message as usual.


my understand:

when we receive WM_CREATE,the child window controls are created.

2.tutorial said:

invoke GetDlgItem,hDlg,IDC_EDIT
invoke SetFocus,eax

After the dialog box is created, I want to set the input focus to the edit control. If I put these codes in WM_CREATE section, GetDlgItem call will fail since at that time, the child window controls are not created yet. The only way you can do this is to call it after the dialog box and all its child window controls are created.


you see the world colored,it seems self-contradiction with 1.

it bewilder me?
Posted on 2004-11-07 19:37:01 by geegle
Hi geegle,

I'm not familiar with the tutorial you talking about but if you are using CreateWindow then put your code after you return from the windows procedure i.e after UpdateWindow.

The WM_CREATE message is sent when an application requests that a window be created by calling the CreateWindowEx or CreateWindow function. (The message is sent before the function returns.) The window procedure of the new window receives this message after the window is created, but before the window becomes visible.


If you are creating a dialog box and processing the WM_INITDIALOG message then put your code under that message.

The WM_INITDIALOG message is sent to the dialog box procedure immediately before a dialog box is displayed. Dialog box procedures typically use this message to initialize controls and carry out any other initialization tasks that affect the appearance of the dialog box.


hope this is helpful, best regards,

czDrillard
Posted on 2004-11-07 22:56:21 by czDrillard
thank you,czDrillard.i have know the mechanism.
Posted on 2004-11-08 19:21:45 by geegle