How can I make windows send a WM_INITIALIZE to a dialog box, every time the box is opened.

What I'm seeing now is that the first time I open the dialog, windows sends a WM_INITIALIZE and I can populate the controls of the box. However if I close the box, then open it again, WM_INITIALIZE doesn't get sent, and the contents of the box may be wrong.

Is there a WM_OPEN message (or anything like it), so I have some way of knowing when the box is re-opened?

Or is there some other standard way ofhandling these situations.
Posted on 2002-04-11 09:34:36 by The Worrier King
WM_INITDIALOG
Posted on 2002-04-11 10:35:12 by f0dder

WM_INITDIALOG
Yeah, sorry, that's what I meant.
Posted on 2002-04-11 13:43:57 by The Worrier King
Hm, you're saying you don't get WM_INITDIALOG second time you
create a dialog box? Weird, for I do :)
Posted on 2002-04-11 13:45:31 by f0dder

Hm, you're saying you don't get WM_INITDIALOG second time you
create a dialog box? Weird, for I do :)
The box that I'm talking about is the child of another dialog box. Maybe that has something to do with it.
Posted on 2002-04-11 15:03:43 by The Worrier King
I can think of four ways to make a dialog box disappear.

1) Minimize or hide the owning (parent) window. In this case, the dialog box is merely hidden, not destroyed.

2) Minimize or hide the dialog box (ShowWindow). You may get a button showing up somewhere, either in the owning window or on the desktop. Once again the dialog box is not destroyed.

3) Cover the dialog box with another window. Need I mention that the dialog box isn't destroyed?

4) Actually destroy the dialog box with EndDialog (modal) or DestroyWindow (nonmodal). In this case only, the window gets destroyed and a new WM_INITDIALOG sent when the dialog box is "reopened". Note: after calling EndDialog (which works only on modal dialogs), you must exit the dialog proc to destroy the window.
Posted on 2002-04-11 15:37:22 by tenkey

4) Actually destroy the dialog box with EndDialog (modal) or DestroyWindow (nonmodal). In this case only, the window gets destroyed and a new WM_INITDIALOG sent when the dialog box is "reopened". Note: after calling EndDialog (which works only on modal dialogs), you must exit the dialog proc to destroy the window.
Yeah, it looks like it was working all along. The problem lay elsewhere.

Thanks for the help.
Posted on 2002-04-11 17:48:20 by The Worrier King