How to detect if mouse had been clicked anywhere on the screen, not only form....
Thank You
Printable View
How to detect if mouse had been clicked anywhere on the screen, not only form....
Thank You
check out this article on vbaccelerator
http://vbaccelerator.com/codelib/hook/vbalhook.htm
it tells you everything about hooks and how to use the in vb
on second thought...
you could also use GetAsyncKeyState API to find out if a certain mouse button has been pressed.
hmm, this is not exactly what I needed I meant global as if the mouse was pressed anywhere on the screen not on the form or control only, even if I doubleclick "My Computer" and form is minimized it still detects mouse click, about GetAsyncKeyState I'll see if I can figure out how to make it work, because I had never used it before, anyway thank you from replying
Here's how you can use the GetAsyncKeyState API:
private Declare Function GetAsyncKeyState Lib "user32" (byval vKey as Long) as Integer
private Const VK_LBUTTON = &H1
private Const VK_RBUTTON = &H2
private Sub Form_Load()
Timer1.Interval = 100
End Sub
private Sub Timer1_Timer()
If GetAsyncKeyState(VK_LBUTTON) then
Caption = "Left Click"
ElseIf GetAsyncKeyState(VK_RBUTTON) then
Caption = "Right Click"
else
Caption = ""
End If
End Sub
Aaron Young
Analyst Programmer
[email protected]
[email protected]
Thanks a lot for helping :o)
[]'s