Howdy, Stranger!

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

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.