Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

BlackDark

Help I dotn know what to do!!!

This topic is 5739 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How do you move the mouse on the screen using visual basics? I want to make a Macro. I Would be most thankfull if somone would tell me. thanks

Share this post


Link to post
Share on other sites
Advertisement
To do that you will need API calls ... put the following code into the general/declarations section of your code:

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 Declare Function SetCursorPos Lib "user32.dll" (ByVal x As Long, ByVal y As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Private Const MOUSEEVENTF_ABSOLUTE = &H8000 ' absolute move
Private Const MOUSEEVENTF_LEFTDOWN = &H2 ' left button down
Private Const MOUSEEVENTF_LEFTUP = &H4 ' left button up


To simulate mouse clicks and set the mouse's position then use the folloing function calls:

' to set the cursor position : SetCursorPos x, y
' To simulate a left click : mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
' to simulate right click : mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0

[edited by - Kronos on February 2, 2003 1:03:49 PM]

[edited by - Kronos on February 2, 2003 1:04:15 PM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!