Click to See Complete Forum and Search --> : Mouse position
macmak
May 17th, 2001, 09:10 PM
PLease help!!!
Does anyone khow to get the mouse position (X,Y)?
Thanks in ADv
///////////////////////////////
MACMAK
///////////////////////////////
cksiow
May 17th, 2001, 09:18 PM
check the mouse move event
Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
X & Y is the position
HTH
cksiow
http://vblib.virtualave.net - share our codes
macmak
May 17th, 2001, 09:22 PM
thank you!
but are ther any code to get ONLY a mouse position?
///////////////////////////////
MACMAK
///////////////////////////////
cksiow
May 17th, 2001, 10:02 PM
check the GetMouseMovePointsEx API, it might help.
shree
May 18th, 2001, 07:00 AM
Try the GetCursorPos() API function.
Cimperiali
May 18th, 2001, 07:29 AM
The mouse event is activated only on form.
The Api shree suggested will get mouse everywhere on screen.
If you need an example, add a Bas module to your project
add this code:
module bas code:
Option Explicit
Public Declare Function GetCursorPos Lib "user32" (lpPoint As PointAPI) As Long
Public Type PointAPI
X As Long
Y As Long
End Type
form code:
'on top:
option explicit
Dim Coords As PointAPI
'where you need to get x and y:
GetCursorPos Coords 'getting position
Me.Caption = "Current Mouse Position: " & Coords.X & "," & Coords.Y 'showing
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.