Originally Posted by
bithub
Hooks are set with the SetWindowsHook() or SetWindowsHookEx() function. Read the MSDN documentation for information on how to use the function.
When you call SetWindowsHook(), your hook gets added to a global chain of hooks. Since this chain must be persistant (even when your application is not running) a hook procedure must be in a DLL. A tutorial on how to make DLL files is outside the scope of a message board post, but you can get plenty of information from google on that.
I wrote up a little example on how to create and set a keyboard hook on this board once. If you do a board search, you can probably find it.