Thread: Pinpoint pixel
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Pinpoint pixel

This is how to get the cursor position

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

Private Type POINTAPI
x As Long
y As Long
End Type

End Sub

Public Function GetPos() As Long
Dim pPosition As POINTAPI
Dim lReturn As Long

On Error Resume Next

lReturn = GetCursorPos(pPosition)
Application.StatusBar = "x co-ordinate: " & pPosition.x & ", y
co-ordinate: " & pPosition.y

End Function


--

HTH

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

"ksel" wrote in message
...
I want to open a picture in a form and with a mouse click
output the position of the mouse pointer within the
picture, i.e. the verticle and horizontal pixel. The part
I don't have is accessing the position of the mouse.