Archived

This topic is now archived and is closed to further replies.

GetAsynchKeyState()

This topic is 5236 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am having a hard time finding a way to poll the mouse to get the cursor position (x,y) in a similar way to GetAsyncKeyState() (with the keyboard). Does such a method exist, or do I have to mess with the message handler? (sorry if this is the wrong board) Regards, Eivind

Share this post


Link to post
Share on other sites
The GetCursorPos function retrieves the cursor''s position, in screen coordinates.

Syntax:
BOOL GetCursorPos(LPPOINT 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.

If the function fails, the return value is zero. 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.

[How To Ask Questions|STL Programmer''s Guide|Bjarne FAQ|C++ FAQ Lite|C++ Reference|MSDN]

Share this post


Link to post
Share on other sites
Weird that i didn''t see this.. Anyway, I have put together a wrapper for DirectInput meanwhile, so I guess I''ll stick to that. Thanks anyway!

Regards,
Eivind

Share this post


Link to post
Share on other sites