Summary:

MDIWINMN demonstrates how to customize the Window menu of an MDI 
Frame window. It shows how to limit the number of listed MDI 
children in the Window menu to any number and how to bring 
up a customized dialog when the MoreWindows menu item is 
selected. It also shows how to list all the MDI children in 
the Window menu without using a MoreWindows menu item.

More Information:

To compile, type NMAKE to build the sample which limits the 
number of MDI child windows listed in the Window menu and 
which brings up the customized dialog when the MoreWindows 
menu item is selected. Type NMAKE MENU=NOLIMIT to build the 
sample that lists all the the MDI children in the Window 
menu without using a MoreWindows menu item. 

The following code changes must be made in the window 
procedure of the MDI frame window to customize the Window 
menu:

1. Specify NULL as the Window menu handle while creating the 
MDI client since the application will handle all the 
processing of the Window menu.

     CLIENTCREATESTRUCT ccs;
     ccs.hWindowMenu  = NULL; 
     ccs.idFirstChild = IDM_FIRSTCHILD;

2. Update the Window menu using ChangeWindowMenu when the 
frame window receives WM_INITMENUPOPUP. ChangeWindowMenu is 
implemented in the sample code.
      
     case WM_INITMENUPOPUP:
         if ((HMENU)wParam == hMenuWindow)
            ChangeWindowMenu(hMenuWindow);
         break;

3. Call ProcessWindowMenu in the default processing of 
WM_COMMAND received by the frame window. ProcessWindowMenu 
is implemented in the sample code.
     case WM_COMMAND:
     {
         switch (wParam)
         {
             :
             :
          default:
             if (ProcessWindowMenu(wParam))
                   return 0L;
             else return DefFrameProc(hwnd, g_hwndMDIClient, 
	
                                     msg, wParam, lParam);
          }
     }

ChangeWindowMenu removes old listings of MDI children from 
the Window menu. It then enumerates the MDI child windows 
and adds their names to the Window menu. This allows the 
Window menu to reflect the current state when it is shown.

ProcessWindowMenu processes the WM_COMMAND messages that 
result from menu selections of the MDI children in the 
Window Menu. It also brings up a customized dialog when the 
MoreWindows menu item is selected.

