| Previous | Next |
| ERROR_INVALID_THREAD_ID | ERROR_POPUP_ALREADY_ACTIVE |
ERROR_NON_MDICHILD_WINDOW
The target does not belong to the MDI child model required by the command.
ERROR_NON_MDICHILD_WINDOW is Win32 error 1445 (0x5A5). Classic multiple document interface operations distinguish the MDI frame, the special MDICLIENT window, and child windows created through the MDI protocol. An ordinary child control, owned popup, tab page, or document window created outside that protocol cannot safely receive every WM_MD* command.
Where applications go wrong
- sending
WM_MDIACTIVATE,WM_MDIDESTROY, or related messages for a normal child - passing the frame window instead of the document child
- creating a document with
CreateWindowExinstead ofWM_MDICREATEor the expected MDI class path - retaining a handle after the MDI child was replaced
- mixing a custom tabbed-document framework with legacy MDI helper code
What the log should show
Capture the message number, target HWND, class name, parent chain, creation path, active MDI child reported by WM_MDIGETACTIVE, and the handle of the MDICLIENT window. Record whether the window was created by the framework or injected by a plug-in. This establishes whether the target participates in MDI semantics rather than merely looking like a document pane.
Diagnostic sequence
Identify the actual MDICLIENT child of the frame and ask it for the active document. Verify that the candidate window is a child of that client and was created as an MDI child. Trace destruction and activation messages because a queued command can arrive after the document closes.
If the product has migrated to tabs or docking panes, search for old MDI utility functions that still assume every document is an MDI child. Compatibility wrappers should route operations by document type instead of sending WM_MD* messages indiscriminately.
Recovery and redesign
Send the command to the correct MDI child, recreate the document using the supported MDI creation sequence, or use the custom framework’s own activation and close APIs. Do not add the WS_CHILD style as a superficial fix; ordinary child status does not make a window an MDI child.
Related codes
ERROR_NOT_CHILD_WINDOW is a general hierarchy error. Error 1445 is specific to MDI membership and can occur even when the target is a valid child window of some container.
Example
A legacy “Close All Documents” command enumerates both MDI documents and a newly added docked preview pane, then sends WM_MDIDESTROY to each handle. The preview produces 1445. Filtering by the MDICLIENT parent and closing the preview through its pane manager resolves the mismatch.
References
- Microsoft: System Error Codes (1300–1699)
- Microsoft: About the Multiple Document Interface
- Microsoft: Using the Multiple Document Interface
Looking for a different code? Search another status or error code.
