|
-
May 15th, 2001, 05:49 PM
#1
Thread Starter
New Member
Detecting MouseUp on another apps form
Hi,
I am trying to find out how I can detect the mouseup on a form that belongs to another application. I can detect the left key via GetAsyncKeyState but haven't come across any code to detect the mouseup.
Any ideas?
Thanks,
Rob
-
May 15th, 2001, 06:48 PM
#2
You can only detect the "MouseDown's" with GetAsyncKeyState. If you want to detect a MouseUp, you'd have to subclass the App.
-
May 15th, 2001, 07:25 PM
#3
You can detect a global MouseUp by Tracking the return value of the same GetAsyncKeyState() API function, i.e.
Code:
Option Explicit
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Sub Form_Load()
Timer1.Interval = 10
End Sub
Private Sub Timer1_Timer()
Static bDown As Boolean
If GetAsyncKeyState(vbLeftButton) < 0 Then
' Log that the Mouse was pressed.
bDown = True
Else
' When the mouse is no longer depressed and it was previously, a Mouse Up must have occured.
If bDown Then Debug.Print "Mouse Up"
bDown = False
End If
End Sub
-
May 16th, 2001, 07:49 AM
#4
transcendental analytic
Actually, you can use a mouse hook instead, that means you don't need to use a timer to repeatedly check for the mouse button states. search on Setwindowhookex and you'll find out.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|