Thread: close all

  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    380

    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);
       }

  2. #2

  3. #3
    Registered User
    Join Date
    Aug 2001
    Posts
    380
    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);
       }

  4. #4
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Close an HTTPListenerResponse.OutputStreram
    By George2 in forum C# Programming
    Replies: 0
    Last Post: 04-23-2008, 11:00 PM
  2. ADO _Recordset close problem...
    By BobS0327 in forum C++ Programming
    Replies: 5
    Last Post: 08-18-2005, 05:53 PM
  3. open() and close()
    By SoFarAway in forum C Programming
    Replies: 3
    Last Post: 04-08-2005, 01:16 PM
  4. XWindows- Close window event?
    By Exile in forum Linux Programming
    Replies: 8
    Last Post: 01-09-2005, 10:39 PM
  5. Ghost in the CD Drive
    By Natase in forum A Brief History of Cprogramming.com
    Replies: 17
    Last Post: 10-12-2001, 05:38 PM