Monday, April 25, 2011

closing a dialog after a delay

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

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

From stackoverflow
  • 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 : 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

0 comments:

Post a Comment