Finding mouse co-ordinates 
Author Message
 Finding mouse co-ordinates

Hi

How can I retrieve the co-ordinate position of the mouse on screen? I have
read what I can find regarding this in the VB6 help file but it was a little
too complicated for me :(

--
WEB: www.geocities.com/dankoasis
MSN: scary_mr_ed AT hotmail.com
AIM: Kane[remove]Jihad



Thu, 10 Feb 2005 01:08:52 GMT  
 Finding mouse co-ordinates
Too easy...  :)

Module:

    Public Type POINTAPI
        X As Long
        Y As Long
    End Type

    Public Declare Function GetCursorPos Lib "user32.dll" (ByRef lpPoint As
POINTAPI) As Long

Code:

    Dim tMousePos As POINTAPI

    Call GetCursorPos(tMousePos)
    Debug.Print tMousePos.X, tMousePos.Y


Quote:
> Hi

> How can I retrieve the co-ordinate position of the mouse on screen? I have
> read what I can find regarding this in the VB6 help file but it was a
little
> too complicated for me :(

> --
> WEB: www.geocities.com/dankoasis
> MSN: scary_mr_ed AT hotmail.com
> AIM: Kane[remove]Jihad



Thu, 10 Feb 2005 10:31:13 GMT  
 Finding mouse co-ordinates
The only way I know off hand to do this involves an API call.  Place the
following code in a module.

'------------start of code-------------
Public Type POINTAPI
 x As Long
 y As Long
End Type

Public Declare Function GetCursorPos Lib "user32" Alias "GetCursorPos"
(lpPoint As POINTAPI) As Long
'------------end of code-------------

To get the mouse cursor coordinates, you need to declare a POINTAPI object
(I'll call it point for demo purposes) using dim just like any other type of
variable.  Then call the function with that POINTAPI object as the
parameter.

Call GetCursorPos(point)

To get the coordinates, just access it using point.x and point.y
respectively.

Hope that helps explain it a little.


Quote:
> Hi

> How can I retrieve the co-ordinate position of the mouse on screen? I have
> read what I can find regarding this in the VB6 help file but it was a
little
> too complicated for me :(

> --
> WEB: www.geocities.com/dankoasis
> MSN: scary_mr_ed AT hotmail.com
> AIM: Kane[remove]Jihad



Thu, 10 Feb 2005 10:56:01 GMT  
 Finding mouse co-ordinates
tnx

--
WEB: www.geocities.com/dankoasis
MSN: scary_mr_ed AT hotmail.com
AIM: KaneJihad

Quote:

> Too easy...  :)

> Module:

>     Public Type POINTAPI
>         X As Long
>         Y As Long
>     End Type

>     Public Declare Function GetCursorPos Lib "user32.dll" (ByRef lpPoint
As
> POINTAPI) As Long

> Code:

>     Dim tMousePos As POINTAPI

>     Call GetCursorPos(tMousePos)
>     Debug.Print tMousePos.X, tMousePos.Y


message

> > Hi

> > How can I retrieve the co-ordinate position of the mouse on screen? I
have
> > read what I can find regarding this in the VB6 help file but it was a
> little
> > too complicated for me :(

> > --
> > WEB: www.geocities.com/dankoasis
> > MSN: scary_mr_ed AT hotmail.com
> > AIM: Kane[remove]Jihad



Sat, 12 Feb 2005 11:29:52 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Forcing mouse pointer to move to a co-ordinate

2. how do i use mouse co-ordinates

3. mouse co-ordinates...

4. Mouse Co-ordinates

5. passing mouse click co-ordinates to class function

6. find value using screen co-ordinates

7. Line Co-ordinates

8. EXCEL 2000 : Selection Co-ordinates

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

10. MDI co-ordinates, docking form and more

11. Co-ordinates

12. print box with co ordinate control

 

 
Powered by phpBB® Forum Software