I'm trying to hook the keyboard and every time I press a key print out "it works!". I know I probably won't get much help, but anything is appreciated.
In your given program there are multiple problems such as you forgetting, the message loop and more importantly forgot the essential part of this program - hook callback, however I have created an example code for you: