Results 1 to 8 of 8

Thread: [VB] Mouse Events Module

  1. #1
    Join Date
    Dec 2007
    Posts
    23
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default [VB] Mouse Events Module

    This module of course comes in great use when your wanting to move your mouse to positions on your screen, Also at the bottom will be examples of how i've used it.

    So, The Module Itself:

    Code:
    Option Explicit
    Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    Public Declare Function GetKeyPress Lib "user32" Alias "GetAsyncKeyState" (ByVal key As Long) As Integer
    Public 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 Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal Y As Long) As Long
    
    Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) 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
    Public Const MOUSEEVENTF_MOVE = &H1
    
    Public Type POINTAPI
        x As Long
        Y As Long
        End Type
    Public Random As Integer
    Public Log As Integer
    
    
    Public Function GetCurrentX() As Long
    Dim Position As POINTAPI
        GetCursorPos Position
        GetCurrentX = Position.x
    End Function
    
    Public Function GetCurrentY() As Long
    Dim Position As POINTAPI
        GetCursorPos Position
        GetCurrentY = Position.Y
    End Function
    
    Public Sub LeftClick()
        LeftDown
        Sleep(Random)
        LeftUp
    End Sub
    
    Public Sub LeftDown()
        mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
    End Sub
    
    Public Sub LeftUp()
        mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
    End Sub
    
    Public Sub MiddleClick()
        MiddleDown
        MiddleUp
    End Sub
    
    Public Sub MiddleDown()
        mouse_event MOUSEEVENTF_MIDDLEDOWN, 0, 0, 0, 0
    End Sub
    
    Public Sub MiddleUp()
        mouse_event MOUSEEVENTF_MIDDLEUP, 0, 0, 0, 0
    End Sub
    
    Public Sub MoveMouse(xMove As Long, yMove As Long)
        mouse_event MOUSEEVENTF_MOVE, xMove, yMove, 0, 0
    End Sub
    
    Public Sub RightClick()
        RightDown
        Sleep(Random)
        RightUp
    End Sub
    
    Public Sub RightDown()
        mouse_event MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0
    End Sub
    
    Public Sub RightUp()
        mouse_event MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0
    End Sub
    Some examples of use:
    Code:
    Public Sub Drop()
    'FIRST ROW
    'First item
        
        Call SetCursorPos(Int(Rnd * 2 + 835), Int(Rnd * 2 + 395))
        Call Sleep(Random)
        Call RightClick
        Call Sleep(Random)
        Call SetCursorPos(Int(Rnd * 2 + 821), Int(Rnd * 2 + 435))
        Call Sleep(Random)
        Call LeftClick
        Call Sleep(Random)
    
    end sub
    //This shows the basics of using the module, The Rnd is a random ammount this trys to stop it being so suspicous - but still be verry careful

    but also:

    Code:
        lblCurrent.Caption = "X Cordinates: " & GetCurrentX & " Y Cordinates: " & GetCurrentY
    //This will show the current mouse X and Y Cordinates into a label called lblCurrent.

    --

    Hope this helps.

    -- Fred

  2. #2
    Join Date
    Oct 2006
    Location
    finland, helsinki
    Posts
    2,501
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Is sleep the same as Wait? if yes u should add one between the mouse clicks.

    (down wait up)

    Code:
    • Narcle: I recall Jukka releasing a bunch of scripts like this before... Its how he rolls I think. rofl
    • Solarwind: Dude, you are like... t3h s3x.
    • Hy71194: JuKKa you're a machine! You released 3 scripts in 10 minutes! :O
    • benjaa: woah.... Jukka is the man Guildminer pwns all
    • NaumanAkhlaQ: And JuKKa Is my Her0!

  3. #3
    Join Date
    Dec 2007
    Posts
    23
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by JuKKa View Post
    Is sleep the same as Wait? if yes u should add one between the mouse clicks.

    (down wait up)
    lol good point,

    updated the code

  4. #4
    Join Date
    Oct 2006
    Location
    finland, helsinki
    Posts
    2,501
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    is "random" a variable?

    I would love if u could add some FindColor functions. And maybe explain them a bit. Never really got into visual basic bots but i might now

    Code:
    • Narcle: I recall Jukka releasing a bunch of scripts like this before... Its how he rolls I think. rofl
    • Solarwind: Dude, you are like... t3h s3x.
    • Hy71194: JuKKa you're a machine! You released 3 scripts in 10 minutes! :O
    • benjaa: woah.... Jukka is the man Guildminer pwns all
    • NaumanAkhlaQ: And JuKKa Is my Her0!

  5. #5
    Join Date
    Dec 2007
    Posts
    23
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yeah its a variable,

    + all the above code is from the module

    i call most of it from the main form:

    Code:
        If GetKeyPress(vbKeyShift) Then 'If the key shift is pressed then:
            Call Drop 'calls the drop function
        End If 'ends the if statement
        Random = Int(Rnd * 300 + 150) 'sets the random variable to a random number
    //Edit - The only problem with VB Bots is people not trusted the application as keyloggers etc can be put inside.

    + i have an aimbot from back in the day for blackhawk down that used findcolours ill dig it up later on

  6. #6
    Join Date
    Mar 2007
    Posts
    674
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    This WILL come in handy...I been wondering how to take control of the mouse, lol

    Ty for posting

  7. #7
    Join Date
    Dec 2006
    Location
    Banville
    Posts
    3,914
    Mentioned
    12 Post(s)
    Quoted
    98 Post(s)

    Default

    Call is legacy coding, you shouldn't really use it anymore.
    The jealous temper of mankind, ever more disposed to censure than
    to praise the work of others, has constantly made the pursuit of new
    methods and systems no less perilous than the search after unknown
    lands and seas.

  8. #8
    Join Date
    May 2006
    Posts
    111
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I haven't used scar or played runescape in the loongest time (since kaitnieks forums). Are there vb bots now?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 08-26-2008, 07:38 PM
  2. Replies: 8
    Last Post: 12-23-2007, 11:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •