| Previous | Next |
| OLEOBJ_S_CANNOT_DOVERB_NOW | INPLACE_S_TRUNCATED |
OLEOBJ_S_INVALIDHWND
OLE verb completed with an invalid parent window handle
OLEOBJ_S_INVALIDHWND is HRESULT 262530 (0x00040182) from winerror.h. The documented description is “Invalid window handle passed.” The high-order severity bit is clear, so this is a success result, but it carries more information than plain S_OK.
The OLE verb path detected that the supplied window handle was invalid, so UI placement or ownership could not follow the requested container relationship.
State to verify
The central question is whether the parent window exists, belongs to the expected UI thread and process, and remains valid for the duration of activation.
Where the result is encountered
- This result can appear in IOleObject::DoVerb calls that pass hwndParent; record the producing interface and method.
- It can appear during in-place activation while a window is being destroyed; record the producing interface and method.
- It can appear in cross-thread UI code using stale HWND values; record the producing interface and method.
Evidence to preserve
- Preserve HWND value and owning thread ID.
- Preserve IsWindow result at the call boundary.
- Preserve window destruction messages.
- Preserve client-site and in-place-site interfaces.
- Preserve rectangle and message-loop state.
Diagnostic sequence
- Capture the raw HRESULT
0x00040182immediately after the returning method and record whether the caller usedSUCCEEDED,FAILED, equality testing, or exception translation. - Verify the method-specific state: the parent window exists, belongs to the expected UI thread and process, and remains valid for the duration of activation.
Correct handling, retry, and recovery
Reacquire the current container window and repeat activation only after its lifetime is guaranteed. Never keep a raw HWND beyond the owner’s documented lifetime.
Practical validation scenario
A background callback invokes DoVerb with a document window that closed milliseconds earlier. The application marshals activation back to the UI thread, obtains the replacement HWND, and avoids reusing the stale handle.
Difference from nearby HRESULT values
OLEOBJ_S_CANNOT_DOVERB_NOW is object-state related; it identifies invalid UI ownership input.
Developer and administrator guidance
Tests should verify both the encoded condition and the resulting outputs. A test that checks only SUCCEEDED cannot detect stale counts, partial streams, adjusted properties, missing callbacks, or other code-specific effects.
References
Looking for a different code? Search another status or error code.