See my response concerning capturing key presses in thread222-775642.
In my first solution referenced there, you'd need to change WH_KEYBOARD for WH_MOUSE and replace vbKeyBoardProc with an implementation of the MouseProc callback
In the second solution, you need to replace WH_KEYBOARD_LL with WH_MOUSE_LL, and replace LowLevelKeyboardProc with an implementation of the LowLevelMouseProcedure callback
In the final solution (journalling), you don't need to do much. The mouse events are being captured already, you really just need to check HookStruct.message for mouse messages...
If you mean that you want to detect a mouse click when any application, not just your VB app, has focus you need a system wide hook. This has to be implemented in a C DLL; can't be written in VB. Once you have the DLL you can call it from your VB app. I did a quick Google search and found this one:
No, it doesn't. This was the old, standard response to this question, and is incorrect. I figured a way around it for tek-tips about 3 years ago - August 2001 to be precise. Thread222-118564 explains how to do this for key presses, but my advice in my previous post in this thread suggests how to change it to work for mouse events.
Finally, about 6 months after the initial solution, figured out the journalling solution (most recently detailed in thread222-775642, to which I refered in my initial post) to get around the limitations inherent in the LowLevel<x> technique (wouldn't work for anything pre NT4 SP3). The journalling solution has one major disadvantage - it slows down your system since it filters every message...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.