|
-
Sep 28th, 2002, 11:09 AM
#1
Thread Starter
New Member
Retrieving Mouse coordinates in Form? *Resolved*
Hi,
I want to set the caption of two labels to the X and Y mouse coordinates when the user presses a command button.
How do I retrieve them in an expression? I have tested Xmouse and Ymouse but that didn't work.
Any help will be appreciated
Man, being a newbie sucks ^_^. But I'll not give up until I'm a pro in VB
Last edited by mattis86; Sep 30th, 2002 at 02:50 PM.
-
Sep 28th, 2002, 11:12 AM
#2
PowerPoster
Well
MouseMove Event of Form I believe returns x and y position...
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Sep 28th, 2002, 11:24 AM
#3
Thread Starter
New Member
But I need to get the values in the Command1_Click() event
-
Sep 28th, 2002, 11:26 AM
#4
-
Sep 28th, 2002, 11:27 AM
#5
PowerPoster
Well
VB Code:
'' Display the co-ordinates of the mouse pointer every 50ms
''
Private lastTick As Long
Private mouseCords As POINTAPI
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function GetTickCount Lib "kernel32" () As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Private Sub Form_Load()
Show
Do
DoEvents
If GetTickCount - lastTick > 50 Then
lastTick = GetTickCount
GetCursorPos mouseCords
With mouseCords
Debug.Print .x & "," & .y
End With
End If
Loop
End Sub
You can just iomplement for the Command1_Click...
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Sep 29th, 2002, 06:58 AM
#6
Thread Starter
New Member
Hey thank you. That worked just fine
-
Sep 29th, 2002, 10:58 AM
#7
PowerPoster
Well
Originally posted by mattis86
Hey thank you. That worked just fine
You are welcome. Add resolved to the subject line of your first thread...
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|