• Log in or sign up for an account here: https://www.sythe.org/login

Force mouse click?

kharg0

Active Member
Joined
Feb 25, 2007
Sythe Gold
0
Messages
131
Force mouse click?
i need a code to force mouse click i have
DECLARE:
Code:
 Private 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)
    Private Const MOUSEEVENTF_LEFTDOWN = &H2
    Private Const MOUSEEVENTF_LEFTUP = &H4

not my code:
and

Code:
Call mouse_event(MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)

now i need to be able to left click and right click

i have a listbox that displays the button that was pressed in text such as "Left"
"Right"
"Middle"

i need it to read that as click accordingly.
thx in advance
 
Force mouse click?
that code will only work for the left mouse click hence "mouse event left - up & down."

i'm not sure what your having trouble with, getting it to click? if this is the case your almost there.

create a timer and add this the the timer:

Code:
mouse_event(mouseeventf_leftdown, 0, 0, 0, 0)
mouse_event(mouseeventf_leftup, 0, 0, 0, 0)

then you will obviously need to do something to active it.

if you want to use a hotkey you can do this...
on the forms keyup property add something along these lines

Code:
if e.keycode = keys.f10 then
timer1.enabled = true

or you can use a button and you would obviously say

Code:
timer1.enabled = true

you get the point...i hope.
 
Force mouse click?
ya thats basically what i have its not that my code is wrong its that my code wont work for right clicking
 
Force mouse click?
ya thats basically what i have its not that my code is wrong its that my code wont work for right clicking

thats because you haven't told it to right click, your code is doing exactly what you have told it to do.

for right clicking you would use this code:

Code:
Private Const MOUSEEVENTF_RIGHTDOWN = &H8
Private Const MOUSEEVENTF_RIGHTUP = &H10

its almost identical to with the left click.

edit: you also mentioned wanting to be able to use the 'middle' mouse click. its not much different from the other two:

Code:
Private Const MOUSEEVENTF_MIDDLEDOWN = &H20
Private Const MOUSEEVENTF_MIDDLEUP = &H40
 
Force mouse click?
thx skate ur the bomb!
 
Runescape Gamblingrunescape gambling
Back
Top