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?
const char g_szChildClassName = "myMDIChildWindowClass";
HWND hwnd = FindWindow(g_szChildClassName,NULL);
SendMessage(hwnd, WM_CLOSE, 0,0);
How do I get the handle of the child to be closed? In the code below am I using the WM_MDIDESTROY correctly?
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.