Author | Message | ||
---|---|---|---|
b_w_johan Regular Posts: 56 | hey, im looking for a way to make my program click on the position 302,912 (in pixels) searched all over internet but nobody ever mentioned it or if they talk about it its about IN a picture. but i need it to click in my form on 302,912 ( made to fields where these positions are filled in but as i don't know how to make it click there its doing nothing...) if you can help me with it would be very nice b_w_johan | ||
b_w_johan Regular Posts: 56 | Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, _ ByVal dX As Long, ByVal dy As Long, ByVal cbuttons As Long, _ ByVal dwExtraInfo As Long) Public Const MOUSEEVENTF_LEFTDOWN = &H2 Public Const MOUSEEVENTF_LEFTUP = &H4 Public Const MOUSEEVENTF_MIDDLEDOWN = &H20 Public Const MOUSEEVENTF_MIDDLEUP = &H40 Public Const MOUSEEVENTF_RIGHTDOWN = &H8 Public Const MOUSEEVENTF_RIGHTUP = &H10 SetCursorPos 302, 912 mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 got this as reply on a forum post .... but it says can't use public constants in this module [06:49] <b_w_johan> what does that meen ?? [07:16] <kepp> remove the public accesifier and create another function for setting the cursor position in the same module ^^ lol that didn't helped me much as i still don't get how to use it, this is rest of my code ... Rem Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long Rem Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, _ rem ByVal dX As Long, ByVal dy As Long, ByVal cbuttons As Long, _ rem ByVal dwExtraInfo As Long) Rem Public Const MOUSEEVENTF_LEFTDOWN = &H2 Rem Public Const MOUSEEVENTF_LEFTUP = &H4 Rem Public Const MOUSEEVENTF_MIDDLEDOWN = &H20 Rem Public Const MOUSEEVENTF_MIDDLEUP = &H40 Rem Public Const MOUSEEVENTF_RIGHTDOWN = &H8 Rem Public Const MOUSEEVENTF_RIGHTUP = &H10 Rem SetCursorPos 302, 912 Rem mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 Rem mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 Private Sub Command1_Click() '// refresh + start clicking on the positions on the point where the 10 points are. WebBrowser1.Navigate "C:\test.html" End Sub Private Sub Command3_Click() '// try to get postion of mouse and fill it in by the fields(will change all the time so manual fill in where it should click) End Sub Private Sub Form_Load() '// on startup open this page. WebBrowser1.Navigate "C:\test.html" '// "Http://sugababes.nl/*_floOr_*" End Sub Private Sub Timer1_Timer() '// make the timer visible in Refreshfield and refresh the page on 0 + on 59 sec it should click on the coordinates Refres.Text = Second(Time) If Refres.Text = 0 Then Command1_Click End Sub hope it makes sence to anyone, i think i have all the code i need now... but it yust isn't working like i want lol | ||
bluebear n00b Posts: 32 | You actually posted the code to yourself :p This should be easy for the bwDC_ programmer ;)
Without running the obove code i'm sure it works. Maybe you also wanna learn the "rules" for the visual basic language. Your code need to be in a module, but the version i posted can run inside a form. | ||
b_w_johan Regular Posts: 56 | Thank you very much bluebear,its working !!!!! asked 4 people for help 2 didn't know 1 posted code wich i couldn't use and you lol. rest tried for 6 day's to make it work =-p indeed i still have to learn basics hehe don't use VB that often, but im trying it now, to see if i like making programs with this better Johan |