Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Pinpoint pixel

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Pinpoint pixel

Spurious End Sub in there, should be

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

Private Type POINTAPI
x As Long
y As Long
End Type

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)

"Bob Phillips" wrote in message
...
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.





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Pinpoint pixel

Thanks, this really works.


-----Original Message-----
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.



.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Pinpoint pixel

Of course it does<vbg

Bob

"ksel" wrote in message
...
Thanks, this really works.


-----Original Message-----
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.



.





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
enter bitmap image pixel data to cells Larry Shindel, MA, REEGT New Users to Excel 0 January 9th 09 03:06 AM
HOW DO I ADJUST ROW HEIGHT BY PIXEL? western jet Setting up and Configuration of Excel 0 March 8th 06 08:44 PM
How do I change chart cell from pixel to inch? Brenda Charts and Charting in Excel 2 February 4th 05 05:05 AM
with same font and pixel number different column width Christian Setting up and Configuration of Excel 0 February 1st 05 04:41 PM
Extract Pixel Values to Excel? CR Optiker Excel Worksheet Functions 1 November 4th 04 10:47 PM


All times are GMT +1. The time now is 02:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"