Sample Download : http://code.msdn.microsoft.com/CppWindowsHook-06957865
A hook is a point in the system message-handling mechanism where an application can install a subroutine to monitor the message traffic in the system and process certain types of messages before they reach the target window procedure.There are two types of Hooks – Thread specific hooks and global hooks. A thread specific hook is associated with particular thread only. While a global hook is associated with all threads in the same desktop as the calling thread. You must place a global hook procedure in a DLL(CppHookDll) separate from the application installing the hook procedure.
You can find more code samples that demonstrate the most typical programming scenarios by using Microsoft All-In-One Code Framework Sample Browser or Sample Browser Visual Studio extension. They give you the flexibility to search samples, download samples on demand, manage the downloaded samples in a centralized place, and automatically be notified about sample updates. If it is the first time that you hear about Microsoft All-In-One Code Framework, please watch the introduction video on Microsoft Showcase, or read the introduction on our homepage http://1code.codeplex.com/.