What does Windows error code 1420 (ERROR_WINDOW_NOT_DIALOG) mean?

 
Previous Next
ERROR_HOTKEY_NOT_REGISTERED ERROR_CONTROL_ID_NOT_FOUND

ERROR_WINDOW_NOT_DIALOG

The HWND does not represent a dialog box

Dialog manager APIs assume a dialog-created window with dialog-specific storage, message handling, and control-navigation behavior. An arbitrary top-level window can contain child controls and still not be a dialog.

This distinction matters in wrappers that accept any HWND. Calling a dialog-specific function on a custom window class may succeed in superficial tests until an operation needs dialog state such as control IDs, default-button handling, or private dialog words.

What to check

  • Trace how the window was created: dialog template APIs versus CreateWindowEx with a custom class.
  • Use generic child-window APIs for non-dialog parents.
  • If a custom window is intended to behave like a dialog, implement the needed message/navigation logic explicitly rather than assuming dialog-manager state.
  • Check that a stale handle has not been replaced by a different window type.

A missing child control in a real dialog is ERROR_CONTROL_ID_NOT_FOUND; this code rejects the parent window type itself.

References


Looking for a different code? Search another status or error code.