| Previous | Next |
| ERROR_HOOK_NEEDS_HMOD | ERROR_JOURNAL_HOOK_SET |
ERROR_GLOBAL_ONLY_HOOK
The hook type must be installed globally
Some USER32 hook categories have scope rules that differ from ordinary thread hooks. A global hook uses a zero thread ID and is associated with threads in the caller's desktop according to SetWindowsHookEx semantics.
The error means a recognized hook type was requested with thread-local scope even though that hook category is global-only. Changing the callback body cannot fix the scope mismatch; the installation parameters and deployment model must change.
What to check
- Verify the selected
WH_*type and its documented scope. - Use
dwThreadId == 0only when a global hook is actually required. - Supply a DLL-based hook procedure and module handle when global injection rules require them.
- Consider a narrower supported event mechanism if system-wide observation is unnecessary.
This differs from ERROR_INVALID_HOOK_FILTER, where the hook type value itself is invalid, and from ERROR_HOOK_NEEDS_HMOD, where scope is chosen but module identification is missing.
References
Looking for a different code? Search another status or error code.