Home All Groups Group Topic Archive Search About

how do I move the mouse programmatically in VB

Author
16 Nov 2007 1:51 PM
Flavio Bortolan
Hallo everybody!

How do  I move the mouse pointer programmatically in VB5.0?

Thanks!

Author
16 Nov 2007 2:15 PM
Mike Williams
"Flavio Bortolan" <FlavioBorto***@discussions.microsoft.com> wrote in
message news:BE2380A7-DF6E-4682-9016-544236A11FEB@microsoft.com...

> How do  I move the mouse pointer programmatically in VB5.0?
> Thanks!

You won't make yourself many friends by repeatedly posting the same
question.

There are a number of different ways of moving the mouse, but one very easy
method is to use the SetCursorPos API which moves the mouse to any specified
screen position. The coordinates are in pixels. For a very simple example
paste the following code into a VB Form then run the program and click the
Form:

Option Explicit
Private Declare Function SetCursorPos Lib "user32" _
  (ByVal X As Long, ByVal Y As Long) As Long

Private Sub Form_Click()
SetCursorPos 0, 0
End Sub

Mike
Author
16 Nov 2007 2:28 PM
HotRod
looks like you already have it working good job. I'm assuming your
programming is what automatically moved, open another message and posted a
reply to your own question. COOL, but not very useful.


Show quote
"Flavio Bortolan" <FlavioBorto***@discussions.microsoft.com> wrote in
message news:BE2380A7-DF6E-4682-9016-544236A11FEB@microsoft.com...
>
> Hallo everybody!
>
> How do  I move the mouse pointer programmatically in VB5.0?
>
> Thanks!
>
>

AddThis Social Bookmark Button