Click to See Complete Forum and Search --> : Hidden Dialog Box


SteveMurphy
October 18th, 2004, 12:49 PM
I have a dialog-based app that is non-MFC and written in C. The dialog is modeless - I create it with CreateDialog() and show it with ShowWindow().

The problem is that when I close the dialog using my programmer-defined Close button or the close box in the dialog frame, the dialog is not destroyed, it is simply hidden. I know this because after I close the dialog, I can find it with the FindWindow() function and display it with the ShowWindow() function.

After I close the dialog box I need it to be completely destroyed. Can anyone help?

Thanks.

kirants
October 18th, 2004, 01:02 PM
Trap WM_CLOSE message and call DestroyWindow(hDlg).

Check this MSDN article (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/dialogboxes/usingdialogboxes.asp)