views:

187

answers:

1

After calling DoModal() on a dialog, and calling a delay function. how do you close the dialog.

m_dlg.DoModal();
Sleep(1000);
.
.
.

+1  A: 

Modal dialogs are modal in the sense that they are shown when you enter DoModal and hidden when DoModal is left. Your dialog is already closed before you call Sleep(1000);

You should use a non-modal dialog for this purpose.

m_dlg.ShowWindow(SW_SHOW); Sleep(1000); m_dlg.ShowWindow(SW_HIDE);

Yarik
how do you use a non-modal dialog?
You create it first and then call ShowWindow.Have a look at this. There is an example there as well. http://msdn.microsoft.com/en-us/library/yhth57kd(VS.80).aspx
Yarik