|
-
Apr 29th, 2004, 01:53 AM
#1
Thread Starter
Fanatic Member
Detect mouse movement anywhere. [resolved]
I'm looking for an API that reacts on mouse movement, even
when the mouse is not on my form.
It would be best if it could activate a sub whenever the mouse
moves.
Searching in MSDN I found mouse_event, which seemed the
perfect solution, but the API has been superseded in Win 2000
and up. Instead I should use SendInput. When I do a
search, the most relevant page is this one, but I wouldn't
have a clue on how to integrate this API into VB...
Does anyone of you know the syntax of SendInput?
- or -
If this isn't the right API after all, what I should use?
Thanks a lot,
arsmakman.
Last edited by arsmakman; Apr 29th, 2004 at 03:40 AM.
No matter how fool-proof your program is, there will always be a better fool.
Was a post helpful to you? Rate it!
-
Apr 29th, 2004, 03:20 AM
#2
So Unbanned
Basically, you can make a timer, then make a call to retrieve the mouse coordinate.
If you do a search you should be able to find a thread here with the APIs and types you need.
-
Apr 29th, 2004, 03:40 AM
#3
Thread Starter
Fanatic Member
After doing a search I found the following code:
VB Code:
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Dim curPos As POINTAPI
Private Sub Timer1_Timer()
GetCursorPos curPos
Text1 = "X:" + Str$(curPos.X) + " Y:" + Str$(curPos.Y)
End Sub
It works perfectly!
No matter how fool-proof your program is, there will always be a better fool.
Was a post helpful to you? Rate it!
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
|