How Do I Make Visual Basic Move the Mouse Cursor? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How Do I Make Visual Basic Move the Mouse Cursor?

I can't seem to find a way to make Visual Basic move the mouse cursor. (The same way that Macro recorder from Win3.x and those annoying joke programs where the mouse won't move over a button do)


Comments

  • : I can't seem to find a way to make Visual Basic move the mouse cursor. (The same way that Macro recorder from Win3.x and those annoying joke programs where the mouse won't move over a button do)

    :



    Here you go:



    APIs:



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



    Use:



    SetCursorPos NewXPos, NewYPos





    Note that the X and Y values are in pixels and not twips, which is the VB default. Make use of Screen.TwipsPerPixelX and Screen.TwipsPerPixelY to ensure that you have the proper conversion amount.



    Hope this helps!



    ===========Ad============

    Keep track of how many downloads are occuring on your site! DownloadCounter does this completely free! When a user clicks the link for your download, a new page opens saying "Contacting download site...". This page contains ads that provide the financing for the service, so there's no cost to you!

    Sign up today, and within minutes your site will be ready to track the downloads!


  • : I can't seem to find a way to make Visual Basic move the mouse cursor. (The same way that Macro recorder from Win3.x and those annoying joke programs where the mouse won't move over a button do)

    : Use following declare statement

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






Sign In or Register to comment.