Results 1 to 4 of 4

Thread: How to move a mouse Randomizely

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    honolulu, HI USA
    Posts
    37

    Post

    I wanna make this program that will move the mouse by giving it some move mouse command, i know the move cursor or sumthing like that and then make em loop or is that it?, anyways is there a better one I can do? HELP!!!

  2. #2
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357

    Post

    You might check out the mouse_event API, which synthesizes mouse movement and button clicking by placing mouse input information into the input stream.

    Check out this link for details:
    http://www.vbapi.com/ref/m/mouse_event.html

    Hope that helps!

    ~seaweed

  3. #3
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111

    Post

    Or if you don't want to do that... here's source code!!! Yay...
    Declare the following in a module:
    [code]
    Option Explicit

    Type POINTAPI
    x As Long
    y As Long
    End Type

    Declare Function SetCursorPos& Lib "user32" _
    (ByVal x As Long, ByVal y As Long)

    Declare Function GetCursorPos Lib "user32" _
    (lpPoint As POINTAPI) As Long
    [code]
    Put this in a timer:
    Code:
    Private Sub Timer1_Timer()
    Dim mp As POINTAPI
    GetCursorPos mp
    SetCursorPos mp.x + (Int(Rnd * 20 + 1) - 10), mp.y + (Int(Rnd * 20 + 1) - 10)
    End Sub
    This moves it x, y from the current position of the mouse rather then scattering all over the screen.
    Good luck,

    ------------------
    DiGiTaIErRoR
    VB, QBasic, Iptscrae, HTML
    Quote: There are no stupid questions, just stupid people.

  4. #4

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    honolulu, HI USA
    Posts
    37

    Post

    Thanxx to both of ye!!!!! I appreciate it!!!!!

Posting Permissions

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



Click Here to Expand Forum to Full Width