|
-
Oct 1st, 2000, 12:06 AM
#1
hello,
i am wondering how to move the mouse with the click of a button,
or a timer. ive looked through the tutorials and i always
get errors whenever i try to put the declarations in. please help quickly, thanks
-
Oct 1st, 2000, 12:12 AM
#2
To move the mouse, use the SetCursorPos api function.
Code:
Private Sub Command1_Click()
Dim t&
t& = SetCursorPos(500,300)
End Sub
-
Oct 1st, 2000, 12:33 AM
#3
ok,
it told me that the setcursorpos was undefined.
-thanks in advance
-
Oct 1st, 2000, 12:47 AM
#4
Oops, it would help if I gave you the api function along with it .
Code:
Declare Function SetCursorPos Lib "user32" (ByVal x _
As Long, ByVal y As Long) As Long
-
Oct 1st, 2000, 12:07 PM
#5
If you're using it in a Form, it should be
Code:
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Otherwise, you must place it in a Module.
-
Oct 1st, 2000, 04:27 PM
#6
thanks megatron,
i needed the private thing in front. but heres another question for you, how do make it move to keep the screen saver at bay?
-
Oct 1st, 2000, 06:33 PM
#7
Simply use a Timer to keep changing the cursor position.
Add the following to a form with a Timer.
Code:
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Private Sub Form_Load()
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Timer()
'Move the Cursor in random places
Randomize
SetCursorPos Int(Rnd * 200) + 1, Int(Rnd * 200) + 1
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|