To control its child windows, an MDI application sends messages to its MDI client window. This type of control includes creating, destroying, activating, or changing the state of a child window.
Generally, an application will work only with the active child window. For example, in Multipad, most of the File menu commands and all of the Edit and Search menu commands refer to the active window. Thus, Multipad maintains the hwndActive and hwndActiveEdit variables, because only the windows identified by those variables will receive messages.
There are exceptions. For example, the application might send messages to all child windows in order to determine each window's state. Multipad does this when closing, to ensure that all files have been saved.
Because MDI child windows may be minimized, the application must be careful to avoid manipulating icon title windows as if they were normal MDI child windows. Icon title windows appear when the application enumerates child windows of the MDI client window. Icon titles differ from other child windows, however, in that they are owned by an MDI child window. Thus, you can use the GetWindow function with the GW_OWNER index to detect whether a child window is an icon title. Non-title windows will return NULL. Note that this test is insufficient for top-level windows, because pop-up menus and dialog boxes are owned windows as well.