SetWindowsHookEx and WM_KEYBOARD_LL

This is a discussion on SetWindowsHookEx and WM_KEYBOARD_LL within the Windows Programming forums, part of the Platform Specific Boards category; As I delve into the depths that are windows hooks and .dll injections, I've run into a problem. I'm trying ...

SetWindowsHookEx and WM_KEYBOARD_LL

As I delve into the depths that are windows hooks and .dll injections, I've run into a problem. I'm trying to practice with hooks by coding a simple keylogger(For my own use, don't worry) and for some reason, it's not working.

I'm calling SetWindowsHookEx(WH_KEYBOARD_LL... I started using WM_KEYBOARD, but it stopped working when I was showing it off to a mate of mine for some reason. Either way - after I changed to KEYBOARD_LL, it didn't work either, so google and google and come up with(It actually said so in the remark section of the MSDN documentation) that the program that calls SetWindowsHookEx needs to have a message loop.

So I google again, find a perfect example which was doing the same as what I was doing, but in that piece of code, he simply calls GetMessage as following:

Code:

while(GetMessage(0,0,0,0))

If I do this, all keyboard input gets flat out hooked and no key messages actually arrive at their destination. However, oddly enough, everything I type gets processed by my callback function and written to the file.

Question is: What is it I'm doing wrong? Why does it work for the guy who posted his source code, but eats all the keys in mine?

Here's the source code for the function in the .dll and the main source code(Yes, I know, I don't need a DLL for this, but I already made one when I found out). Is there something wrong in the callback function?

EDIT: Aw mah gawd.. Sorry about that. JUST after I posted the post, I figured out that return 1 after processing the message could mean that I wouldn't send the message on. And so it was. Instead of return 1, return the return value from CallNextHookEx like at the bottom of the code.
Sorry again - I've been ........ing around with this for hours to no avail and decided to eventually post.