Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

close all children of a dialog box

Status
Not open for further replies.

dima2

Programmer
Jan 20, 2002
85
LB
hi,
i have a dialog based application, and at a certain point I would like to close all the dialog boxes (children of the main dialog window ) that were created by domodal().
how can i do that??
 
You can find all Children with EnumChildWindows(...) and then close they with SendMessageTimeout(hwnd, WM_CLOSE, ...).
A sample:


BOOL CALLBACK FindChildWindowProc( HWND hwnd, LPARAM lParam )
{
DWORD dwResult;
::SendMessageTimeout( hwnd, WM_CLOSE, 0, lParam, SMTO_NORMAL, 4000, &dwResult );
}

......
//In another Function, hwnd is the Handle of Your Dialog's main Window.
EnumChildWindows(hwnd, FindChildWindowProc, 0);
 
thank you for your reply, but
the callback is getting called for the controls that are in the main dialog box !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top