Ok, thanks for everyone in the comments, I think @RbMm is correct, after running the program in a debugger, and adding a break point in handler
, then reviewing the backtrace, it reveals that GetMessage
is indeed called before handler
, and that both are called on the main thread.
handler(HWINEVENTHOOK ev_hook, DWORD event, HWND win, LONG obj_id, LONG child_id, DWORD event_thread_id, DWORD event_time_ms) (c:\\winman\\winman.c:176)
user32.dll!USER32!RegisterWindowMessageA (Unknown Source:0)
ntdll.dll!ntdll!KiUserCallbackDispatcher (Unknown Source:0)
win32u.dll!win32u!NtUserGetMessage (Unknown Source:0)
user32.dll!USER32!GetMessageA (Unknown Source:0)
main() (c:\\winman\\winman.c:62) -- this is where GetMessage is actually located in my source code