PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Calculating the mouse position
  • Various
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Returns and modifies the position of the mouse cursor.
Note: To find out the current position of the mouse, we recommend that you use MouseXPos and MouseYPos.
Example
Res is int = CursorPos(cpClient)
IF Res <> -1 THEN
Message("Position X = " + LoWord(Res) + "Position Y = " + HiWord(Res))
END
Syntax
<Result> = CursorPos([<Marker>,] <X Position> , <Y Position>)
<Result>: Integer
Position of the mouse (the coordinates are returned by HiWord and LoWord).
  • Current position if <X Position> and <Y Position> are not specified.
  • Previous position if <X Position> and <Y Position> are specified.
  • -1 if an error occurs (position of the mouse outside the requested marker for example).
<Marker>: Optional integer constant
Indicates the marker used to calculate the position:
cpScreen
(Default value)
Position of the mouse in relation to the screen.
cpWindowPosition of the mouse in relation to the window with focus.
cpClientPosition of the mouse in relation to the client area of the window with focus.
Client Area = window without title bar, menu bar and border.
<X Position>: Real
New horizontal position in the selected marker.
<Y Position>: Real
New vertical position in the selected marker.
Remarks

Calculating the mouse position

To find out the horizontal and vertical position of the mouse from the result, you must use HiWord and LoWord.
The low byte of <Result> is used to get the horizontal position (X) of the mouse.
The high byte of <Result> is used to get the vertical position (Y) of the mouse. If an error occurs, X and Y are equal to -1.
The coordinates are relative to the top left corner of the selected marker.

Various

  • MouseXPos and MouseYPos respectively return the horizontal and vertical positions of the mouse in relation to the control where a left mouse click was performed.
  • You can, for example, calculate the position of the mouse cursor in a timer in order to always display this position on the screen.
Components
WINDEVReports and Queries wd230std.dll
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment