I've found an app which calls DialogBoxParam, but destroys the dialog from inside WM_INITDIALOG, yet expects the dialog to still be alive until WM_INITDIALOG processing is done, i.e.
case WM_INITDIALOG: ... initialize and write values to lots of controls ...
if (user_dont_want_to_see_this_dialog_today) { DestroyWindow(hDlg);
... mess some more with controls (like reading their current values) ...
return; }
Does anyone have a good way to deal with this? One way might be to make DestroyWindow map to EndDialog in this case (as EndDialog manages to handle this right), but what would the best way to do that be?