My guess would be that the reason is that you don't have a window in your application. See the documentation of KeyboardProc callback
KeyboardProc callback[
^].
There it says that the hook function is only called "whenever an application calls the GetMessage or PeekMessage function and there is a keyboard message (WM_KEYUP or WM_KEYDOWN) to be processed".
In your case there is no window, and hence no message to be processed.
In contrast, the low level events work without a valid message queue; they are fired whenever the keyboard event is being generated.
Resolution: Open a window in your main function, let that window get the focus and then everything should work fine.