If you find yourself trying to install low level windows keyboard handlers, perhaps to intercept the windows key, you'll likely encounter a cryptic error message:
C2065: 'WH_KEYBOARD_LL': undeclared identifier
Chances are you're writing a LowLevelKeyboardHook function, you're calling CallNextHookEx, and you're installing the handler with something like:
hook = SetWindowsHookEx ( WH_KEYBOARD_LL, LowLevelKeyboardHook, GetModuleHandle(NULL), 0 );
To make this compile, you have to tell Visual Studio that you're targeting only recent versions of Windows. You do this by creating a preprocessor definition, making _WIN32_WINNT be 0x0500.
You can put this at the very beginning of something like your stdafx.h
file if you like. You have to be sure you define this before
Or you could do what I do: put it in the project definitions. Go to the Project properties for your project, go to "Configuration Properties", "C/C++", "Preprocessor", and add it into "Preprocessor Definitions". As you can see in the image below, I also have UNICODE and _UNICODE defined without values; multiple definitions are separated by semicolons
UNICODE;_UNICODE;_WIN32_WINNT=0x0500
I like this approach because I can be totally sure that the definition
will happen before