Virtual mouse click inside a webbrowser at a specific x and
Posted: Sun Nov 25, 2012 1:53 am
Hi guys so my problem is that the mouse moves and I don't want it to move here the code I have
Code: Select all
but this does not work this is in visual basic 2010 Declare Function mouse_event Lib "user32.dll" Alias "mouse_event" (ByVal dwFlags As Int32, ByVal dX As Int32, ByVal dY As Int32, ByVal cButtons As Int32, ByVal dwExtraInfo As Int32) As Boolean
Public Const MOUSE_LEFTDOWN = &H2
Public Const MOUSE_LEFTUP = &H4
Private Sub RouletteXPro_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Enabled = True
Timer2.Enabled = True
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim x As Int32, y As Int32
'Change 'WebBrowser1.Width\2' and 'WebBrowser1.Height\2' to where ever you want the event to occur
'but remember to keep it within the webBrowser's size range.
x = WebBrowser1.Width - 100
y = WebBrowser1.Height - 100
'This will click dead center of the webBrowser.
Call mouse_event(MOUSE_LEFTDOWN, x, y, 0, 0)
Call mouse_event(MOUSE_LEFTUP, x, y, 0, 0)
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
Label1.Text = Val(Label1.Text) - 1
If Label1.Text = 0 Then
Timer1.Enabled = False
End If
End Sub