| Previous | Next |
| ERROR_INVALID_SCROLLBAR_RANGE | ERROR_NO_SYSTEM_RESOURCES |
ERROR_INVALID_SHOWWIN_COMMAND
The requested window show operation is not valid.
ERROR_INVALID_SHOWWIN_COMMAND is Win32 error 1449 (0x5A9). The caller asked USER32 to show, hide, restore, minimize, maximize, or otherwise change a window using a command that the specific API or current operation does not accept. Integer show commands are not general-purpose bit flags and should not be combined.
Likely sources
- passing a
SW_*value to an API that expects different flags - combining two show commands with bitwise OR
- forwarding an unvalidated startup or IPC value
- confusing
ShowWindowcommands withSetWindowPosflags - using a command against a window that has already been destroyed or replaced during a transition
Evidence to retain
Log the API, numeric command, symbolic name selected by the caller, target HWND, window style, current visibility and placement, owning thread, and the origin of the request. If the value crossed process boundaries, preserve protocol version and raw field value. Record whether the call occurs during creation, activation, shutdown, or DPI reconstruction.
Diagnostic sequence
Compare the value with the exact command set documented for the function. Ensure that wrappers do not reuse one enum for ShowWindow, ShowWindowAsync, shell execution, and window-placement APIs. Inspect default switch branches and deserialization code that can produce out-of-range values.
Check the target’s lifetime and thread ownership separately. Even with a valid command, asynchronous show requests can arrive after a tool window has been destroyed. A generation-aware window reference prevents a stale command from being redirected to a newly reused handle value.
Corrective action
Validate commands at the boundary, store them in a dedicated enum, and translate explicitly when calling another API family. For compound behavior such as restore-then-activate, perform documented operations in sequence rather than inventing a combined number. Reject unsupported remote commands with a protocol error before reaching USER32.
Difference from common show failures
ERROR_INVALID_WINDOW_HANDLE indicates a bad target handle. Error 1449 indicates an invalid show command or display transition. A hidden but valid window does not by itself imply an error.
Example
A remote-control protocol defines “maximize and activate” as two bits. The receiver forwards the bitmask directly as nCmdShow, producing 1449. Translating the protocol flags into a valid SW_RESTORE or SW_MAXIMIZE command followed by foreground handling fixes the contract.
References
Looking for a different code? Search another status or error code.
