-
close all
I'm trying to add a close all command to my text editor. I have tried putting the below code in the WndProc and MDIProc but nothing happens. Where does it go?
Code:
const char g_szChildClassName[] = "myMDIChildWindowClass";
case CM_CLOSEALL:
{
HWND hwnd = FindWindow(g_szChildClassName,NULL);
SendMessage(hwnd, WM_CLOSE, 0,0);
}
-
-
Thank you.
How do I get the handle of the child to be closed? In the code below am I using the WM_MDIDESTROY correctly?
Code:
case CM_CLOSEALL:
{
HWND hChild;
while(hChild = (FindWindow(g_szChildClassName,NULL)) != NULL)
SendMessage(hwnd, WM_MDIDESTROY, hChild,0);
}
-
Typically, EnumChildWindows is used to iterate through the mdi child windows - the child window handle is passed as a parameter to the EnumChildProc callback procedure.
There is an example of its use in this thread, courtesy of Fordy.