| Previous | Next |
| ERROR_INVALID_HOOK_HANDLE | ERROR_TLW_WITH_WSCHILD |
ERROR_INVALID_DWP_HANDLE
The multiple-window-position handle is invalid
BeginDeferWindowPos creates an HDWP state object that is updated by each DeferWindowPos call and consumed by EndDeferWindowPos. It is a short-lived operation chain, not a reusable layout handle.
The important contract detail is that DeferWindowPos returns the updated handle, and that returned value can differ from the value passed in. Continuing with the old HDWP, reusing a handle after EndDeferWindowPos, or continuing after a failed defer call can invalidate the chain.
What to check
- Assign the result of every
DeferWindowPoscall back to the trackedHDWP. - Stop the sequence immediately if a defer call returns NULL and capture
GetLastError. - Call
EndDeferWindowPosonce for the final live handle. - Do not retain the handle for a later layout pass.
If the chain is valid but its windows have different parents, the more specific condition is ERROR_HWNDS_HAVE_DIFF_PARENT.
References
Looking for a different code? Search another status or error code.