In order to setup a low level mouse and keyboard hook in VB.NET, we use P/Invoke to call Windows API SetWindowsHookEx, CallNextHookEx, UnhookWindowsHookEx, and GetModuleHandle.
When we want to stop the low level mouse or keyboard hook, we can use the UnhookWindowsHookEx function to remove the hook procedure installed. The parameter is the hook ID which we get from the SetWindowsHookEx function.
Here is an article on this topic by Paul Kimmel:
http://www.developer.com/net/net/article.php/11087_2193301_1
Related threads:
http://social.msdn.microsoft.com/forums/en-US/Vsexpressvb/thread/dc85ffc5-90e0-484d-8031-ffb82188feb4/
http://social.msdn.microsoft.com/forums/en-US/Vsexpressvb/thread/98c8e36f-c0ba-4eac-a679-8b1d32e73ce7/
For more FAQ about Visual Basic .NET General, please see Visual Basic .NET General FAQ
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.