|
||||
GetCursorPosCategory: CursorHits: 11844 Rating: (2.36) votes 1283
Rate: 1-star 2-stars 3-stars 4-stars 5-stars
API Explanation
GetCursorPos reads the current position of the mouse cursor. The x and y coordinates of the cursor (relative to the screen) are put into the variable passed as lpPoint. The function returns 0 if an error occured or 1 if it is successful. Parameter Information Declare Function GetCursorPos Lib "user32.dll" (lpPoint As POINT_TYPE) As Long lpPoint Receives the x and y coordinates of the mouse cursor.
Code
' Display the coordinates of the mouse cursor
Dim coord As POINT_TYPE ' receives coordinates of cursor Dim retval As Long ' return value retval = GetCursorPos(coord) ' read cursor location Debug.Print "The mouse is at:"; coord.x; coord.y |