Skip to content

Latest commit

 

History

History
56 lines (38 loc) · 1.75 KB

GetCursorPos.md

File metadata and controls

56 lines (38 loc) · 1.75 KB

Home

Function name : GetCursorPos

Group: Cursor - Library: user32


Retrieves the cursor"s position, in screen coordinates.


Code examples:

Clipping mouse cursor area
Creating a clipping region from the path selected into the device context of a form
Tracking mouse movement to detect when to start dragging
Using FoxTray ActiveX control: System Tray Icon and menu attached to VFP form
Form Magnifier
Shortcut Menu Class
GDI+: Implementing image scrolling with inertia

Declaration:

BOOL GetCursorPos(
  LPPOINT lpPoint   // cursor position
);  

FoxPro declaration:

DECLARE SHORT GetCursorPos IN user32 STRING @ lpPoint  

Parameters:

lpPoint [out] Pointer to a POINT structure that receives the screen coordinates of the cursor.


Return value:

If the function succeeds, the return value is nonzero.


Comments:

This function returns an absolute screen position.

Position the cursor with MOUSE AT , ; where x and y are local coordinates of VFP main window. After that read the cursor position with GetCursorPos function. That gives you a difference between local and global coordinates.

Put = INKEY(0.1) or any other delay between setting and reading the cursor position. It seems that without such delay VFP does not have enough time to inform the OS about mouse cursor repositioning.