Tech Support > Microsoft Windows > Development Resources > modeless and modal dialog
modeless and modal dialog
Posted by Zachary Turner on January 26th, 2005


I am trying to create a modeless dialog that all it does is display a
static text field (I'm using ATL dialogs actually, but it maps straight
down to Windows API calls). Anyway my code is something like the
following:


CMyDialog dlg;
dlg.Create(hwndParent);
dlg.ShowWindow(SW_SHOW);
Sleep(2000):
dlg.ShowWindow(SW_HIDE);
dlg.DestroyWindow();

Now, the dialog shows up fine and I can see the title bar. However,
the static text field is not visible. If, on the other hand, I execute
the code:

CMyDialog dlg;
dlg.DoModal(hwndParent);

then I can see the static text field and the dialog displays perfectly.
My code is simple enough that I have a feeling this is just one of
those common mistakes that everyon mistakes at least once, but I can't
figure out what it is. Does anybody have an idea what could be going
wrong? Thank you.

Posted by Sten Westerback on January 26th, 2005



"Zachary Turner" <divisortheory@gmail.com> wrote in message
news:1106757815.989942.5700@z14g2000cwz.googlegrou ps.com...
Sounds like a missing message loop...

- Sten




Posted by Tony Nelson on January 26th, 2005


In article <1106757815.989942.5700@z14g2000cwz.googlegroups.c om>,
"Zachary Turner" <divisortheory@gmail.com> wrote:

Well, you aren't letting your thread process any messages, while the
DoModal thing runs a message loop. Windows is based on messaging, and
you usually need to let it do its thing. There are even messages for
timers! Petzold would be a good place to start.

BTW, what books are you using now?
__________________________________________________ ______________________
TonyN.:' <mailto:tonynlsn@shore.net>
' <http://www3.primushost.com/~tonynlsn/>



Similar Posts