How can I use ’Hooks’ in .NET
Please check out this article from the October 2000 issue of MSDN Magazine.
Allen Weng gives the following explanation in a post on the microsoft.public.dotnet.framework.windowsforms newgroup.
If what you are looking for is just to intercept and handle generic Windows messages such as WM_NCPAINT or alike, you can override WndProc (). You don’t need to use the hook procedure. Here is some code that does this:
But if you need to use a hook procedure, be cautious since they might interfere with normal execution of other applications. In some extreme cases, they might bring the whole system down if not processed correctly. Here is the code snippet that shows you how to do implement and use the hook procedure in .NET:
To install the hook procedure