Forcing mouse pointer to move to a co-ordinate 
Author Message
 Forcing mouse pointer to move to a co-ordinate

Hi there.

I am trying to make a macro-recorder like application in Visual Basic
5, and I need to be able to send the mouse pointer to a particular
screen co-ordinate (without the need to physically touch the mouse of
course), simulate mouse-clicks and stuff like that.

I'm sure it can be done, but I don't have any idea how.

Could you please help? Thanks

Regards,
Clyde.

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Wed, 10 Apr 2002 03:00:00 GMT  
 Forcing mouse pointer to move to a co-ordinate
To move the mouse
==============
Declare this in the (General)(Declarations) section of the form you want to
use it on; or remove the Private keywords and place it in a BAS Module
(Project/AddModule from VB's menu bar) to make it globally available

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

Then just use it, like so

       SetCursorPos 50, 50

To click a CommandButton
===================
Command1.Value = True

Rick

Quote:

> Hi there.

> I am trying to make a macro-recorder like application in Visual Basic
> 5, and I need to be able to send the mouse pointer to a particular
> screen co-ordinate (without the need to physically touch the mouse of
> course), simulate mouse-clicks and stuff like that.

> I'm sure it can be done, but I don't have any idea how.

> Could you please help? Thanks

> Regards,
> Clyde.

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Wed, 10 Apr 2002 03:00:00 GMT  
 Forcing mouse pointer to move to a co-ordinate
Now I'm curious... How do get the current mouse coordinates?

Thanks.

Quote:

>To move the mouse
>==============
>Declare this in the (General)(Declarations) section of the form you want to
>use it on; or remove the Private keywords and place it in a BAS Module
>(Project/AddModule from VB's menu bar) to make it globally available

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

>Then just use it, like so

>       SetCursorPos 50, 50

>To click a CommandButton
>===================
>Command1.Value = True

>Rick


>> Hi there.

>> I am trying to make a macro-recorder like application in Visual Basic
>> 5, and I need to be able to send the mouse pointer to a particular
>> screen co-ordinate (without the need to physically touch the mouse of
>> course), simulate mouse-clicks and stuff like that.

>> I'm sure it can be done, but I don't have any idea how.

>> Could you please help? Thanks

>> Regards,
>> Clyde.

>> Sent via Deja.com http://www.deja.com/
>> Before you buy.



Wed, 10 Apr 2002 03:00:00 GMT  
 Forcing mouse pointer to move to a co-ordinate

Type POINTAPI
    X As Long
    Y As Long
End Type

Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long

and...

Dim lppt As POINTAPI

Call GetCursorPos(lppt)

... now lppt contains the cursor coordinates.

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Please post/reply to the newsgroup(s)

Klaus H. Probst
http://www.vbbox.com/
~~~~~~~~~~~~~~~~~~~~~~~~~~~


Quote:
> Now I'm curious... How do get the current mouse coordinates?

> Thanks.


> >To move the mouse
> >==============
> >Declare this in the (General)(Declarations) section of the form you want to
> >use it on; or remove the Private keywords and place it in a BAS Module
> >(Project/AddModule from VB's menu bar) to make it globally available

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

> >Then just use it, like so

> >       SetCursorPos 50, 50

> >To click a CommandButton
> >===================
> >Command1.Value = True

> >Rick


> >> Hi there.

> >> I am trying to make a macro-recorder like application in Visual Basic
> >> 5, and I need to be able to send the mouse pointer to a particular
> >> screen co-ordinate (without the need to physically touch the mouse of
> >> course), simulate mouse-clicks and stuff like that.

> >> I'm sure it can be done, but I don't have any idea how.

> >> Could you please help? Thanks

> >> Regards,
> >> Clyde.

> >> Sent via Deja.com http://www.deja.com/
> >> Before you buy.



Wed, 10 Apr 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. move a mouse pointer to a different location without moving the mouse

2. Finding mouse co-ordinates

3. how do i use mouse co-ordinates

4. mouse co-ordinates...

5. Mouse Co-ordinates

6. passing mouse click co-ordinates to class function

7. getting mouse coordinate when moving over a form

8. Line Co-ordinates

9. EXCEL 2000 : Selection Co-ordinates

10. Obtaining x,y co-ordinates of a Dropped Object

11. MDI co-ordinates, docking form and more

12. Co-ordinates

 

 
Powered by phpBB® Forum Software