View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default capturing mouse positions at any moment

Hi Shrinu,

Here is some code to return the mouse position as a simple function .

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

Private Type POINTAPI
x As Long
y As Long
End Type

Sub test()
Dim pPosition As POINTAPI
Dim lReturn As Long

lReturn = GetCursorPos(pPosition)
MsgBox "Cursor position is:" & vbCrLf & _
"x co-ordinate: " & pPosition.x & vbCrLf & _
"y co-ordinate: " & pPosition.y

End Sub

I also have some code that dynamically returns the mouse position into the
status bar. Post back if that would be useful.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Shrinu" wrote in message
m...
Hi,

I need to find out the position of a mouse at any given moment , i.e
without any event happening, is this possible. If yes ,how can i do
that. Please help me on this.
Thanks in advance.

Regards
Shrinu