I am creating a keystroke logger for my personal interest, as well wanting to know how to capture and use them as functions (like key shortcuts).
I got the code to l
Basically, you want to use this function:
HHOOK SetWindowsHookEx(
__in int idHook,
__in HOOKPROC lpfn,
__in HINSTANCE hMod,
__in DWORD dwThreadId
);
You can read up on what the parameters mean (and there's plenty of examples around) but the part that answers your question is the second parameter. You set lpfn to point to a callback function, and every time a key is pressed your function (the one that logs the keystroke) gets called.
It's not just for the keyboard events either, check it out: SetWindowsHook()