Export (0) Print
Expand All
15 out of 33 rated this helpful - Rate this topic

GetCursorPos function

Retrieves the position of the mouse cursor, in screen coordinates.

Syntax


BOOL WINAPI GetCursorPos(
  _Out_  LPPOINT lpPoint
);

Parameters

lpPoint [out]

Type: LPPOINT

A pointer to a POINT structure that receives the screen coordinates of the cursor.

Return value

Type: BOOL

Returns nonzero if successful or zero otherwise. To get extended error information, call GetLastError.

Remarks

The cursor position is always specified in screen coordinates and is not affected by the mapping mode of the window that contains the cursor.

The calling process must have WINSTA_READATTRIBUTES access to the window station.

The input desktop must be the current desktop when you call GetCursorPos. Call OpenInputDesktop to determine whether the current desktop is the input desktop. If it is not, call SetThreadDesktop with the HDESK returned by OpenInputDesktop to switch to that desktop.

Examples

For an example, see Using the Keyboard to Move the Cursor.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

See also

Reference
ClipCursor
GetCursorInfo
SetCursor
SetCursorPos
ShowCursor
GetMessagePos
Conceptual
Cursors
Other Resources
POINT

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.