|
-
Jan 20th, 2010, 04:56 PM
#1
Thread Starter
Member
[2008] Mouse Recorder
im working on a mouse recorder.. but it will not play the co-ordinates or clicks that i recorded. can somebody tell me what i done wrong or if there is other codes i can use and what they are?
My current codes:
Code:
Public Class Form1
Dim result As Integer
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Integer, ByVal dx As Integer, ByVal dy As Integer, ByVal cButtons As Integer, ByVal dwExtraInfo As Integer)
Private Const MOUSEEVENTF_ABSOLUTE = &H8000 ' absolute move
Private Const MOUSEEVENTF_LEFTDOWN = &H2 ' left button down
Private Const MOUSEEVENTF_LEFTUP = &H4 ' left button up
Private Const MOUSEEVENTF_MOVE = &H1 ' mouse move
Private Const MOUSEEVENTF_MIDDLEDOWN = &H20
Private Const MOUSEEVENTF_MIDDLEUP = &H40
Private Const MOUSEEVENTF_RIGHTDOWN = &H8
Private Const MOUSEEVENTF_RIGHTUP = &H10
::::Codes for recording::::
Code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim Mouse As Point = Control.MousePosition
If GetAsyncKeyState(MOUSEEVENTF_LEFTDOWN) Then
ListBox1.Items.Add("Left")
End If
If GetAsyncKeyState(MOUSEEVENTF_RIGHTDOWN) Then
ListBox1.Items.Add("Right")
End If
ListBox1.Items.Add(Mouse.X & "," & Mouse.Y)
End Sub
::::Codes for playing::::
Code:
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
If ListBox1.Text = "Left" Then
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
ElseIf ListBox1.Text = "Right" Then
mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0)
ElseIf ListBox1.SelectedIndex = ListBox1.SelectedIndex + +1 Then
Else
MsgBox("A Problem Has Occured")
End If
End Sub
Please Help me with this.. i really need to get this to work
-
Jan 20th, 2010, 09:26 PM
#2
Thread Starter
Member
Re: [2008] Mouse Recorder
bump
-
Jan 20th, 2010, 10:26 PM
#3
Re: [2008] Mouse Recorder
Well for one, your GetAsyncKeyState is wrong: GetAsyncKeyState(1) returns the left mouse button and GetAsyncKeyState(2) returns the right button.
Als, to make a click, you might need to send MOUSEEVENTF_(LEFT/RIGHT)UP right after you send down?
-
Jan 21st, 2010, 05:41 PM
#4
Thread Starter
Member
Re: [2008] Mouse Recorder
GetAsyncKeyState(1) returns the left mouse button and GetAsyncKeyState(2) returns the right button
ok im kind of new at this... could you show me a quick example. ill rep ++ u
-
Jan 21st, 2010, 06:17 PM
#5
Re: [2008] Mouse Recorder
Well, right now you have GetAsyncKeyState(MOUSEEVENTF_LEFTDOWN). Change that to GetAsyncKeyState(1). Then change GetAsyncKeyState(MOUSEEVENTF_RIGHTDOWN) To GetAsyncKeyState(2).
-
Jan 22nd, 2010, 09:41 PM
#6
Thread Starter
Member
Re: [2008] Mouse Recorder
its still not working with me... any other suggestions?
-
Jan 23rd, 2010, 11:40 AM
#7
Re: [2008] Mouse Recorder
To simulate a proper mouse click, I think you'd want to add mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0) right after mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0), and same thing with the right mouse button. If that doesn't work, you could try adding a 50 - 150 millisecond pause between the two calls.
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
|