[Help] Mouse button

Posts 1–15 of 21 · Page 1 of 2
[Help] Mouse button
ok i want to create a loop that when a button or hotkey is pressed it will...
when you press and hold the mouse button instead of single clicking it will send the button ever x amount of secs

example.. in autohotkey i have a rapid fire script that looks like this
[PHP]Ins::Suspend
LButton::
Loop
{
SetMouseDelay 15
Click
If (GetKeyState("LButton","P")=0)
Break
}

[/PHP]
which is what im looking to put into a loop i know it in ahk but not in vb any idea what i need to do
what do you mean exactly? Do you want it to continually click for a certain amount of seconds or what? Sorry I didn't understand you properly.
sorry kind of hard to explain ok in the script i have when you use say the fal in mw2 and you click and hold the fire button it make the fal full auto by sending the fire button repeatedly and i want to code that in vb not sure how

that help any?

p.s. congratz on 1337
Quote Originally Posted by Maniac101 View Post
sorry kind of hard to explain ok in the script i have when you use say the fal in mw2 and you click and hold the fire button it make the fal full auto by sending the fire button repeatedly and i want to code that in vb not sure how

that help any?

p.s. congratz on 1337
Hmm do you want it to just hold down the Lbutton for a period of time or does it have to click over and over?

either way you need these declarations and constants

[php]
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 LButtonDown = &H2
Private Const LButtonUp = &H4
[/php]

Okay for repeated clicking,

[php]
Do until (make an exit statement here, could be a hotkey or anything)

mouse_event(LButtonDown, 0, 0, 0, 0)
mouse_event(LbuttonUp, 0, 0, 0, 0)

Loop
[/php]

To hold it down

[php]

mouse_event(LButtonDown, 0, 0, 0, 0)

Do until (exit statement here)
System.Threading.Thread.Sleep(1)
Loop

mouse_event(LButtonUp, 0, 0, 0, 0)

[/php]

either of those help you?
ill fiddle with it later on looks like thats what i need ill report back on results or issues once again

sir rock
what
hes j-D?
Quote Originally Posted by Devient_ View Post
what
hes j-D?
Yes, I'm "J-Derry" you got trolled.
[php]private sub RapidFire(Byval sleeptime as integer)
Do while getasynckeystate(LButtonDown) ' = True

mouse_event(LButtonDown, 0, 0, 0, 0)
mouse_event(LbuttonUp, 0, 0, 0, 0)
threading.thread.sleep(sleeptime)

loop
end sub[/php]

[php]RapidFire(15)[/php]

This will click the left mousebutton and wait 15 miliseconds.

Should work =/
do i use this with nextgens keyboard hook?
No. You only need the following:

[php] Public Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Int32) As Int16

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 LButtonDown = &H2
Private Const LButtonUp = &H4
[/php]
Quote Originally Posted by Blubb1337 View Post
No. You only need the following:

[php] Public Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Int32) As Int16

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 LButtonDown = &H2
Private Const LButtonUp = &H4
[/php]
Copy and pasted my constants nub
Quote Originally Posted by Blubb1337 View Post
No. You only need the following:

[php] Public Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Int32) As Int16

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 LButtonDown = &H2
Private Const LButtonUp = &H4
[/php]
... thats where i went wrong i declared it wrong i knew i seen it before but when i typed it out i missed some lol thanks bud

i already had them i just declared that getasynckeystate wrong NUB lol jk

<----- is the nub in this matter
Quote Originally Posted by Imported View Post


Copy and pasted my constants nub
The constants are always the same nub!
ive been trolled :O
To make life easier, everyone should use the low level keyboard and mouse module
Posts 1–15 of 21 · Page 1 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?