Skip to main content
GameDev.net gamedev.net
🔒 Locked

GetAsynchKeyState()

Started by Qpeg Aug 15, 2003 at 6:30 AM 1 replies 950+ views
Original Post
Qpeg
Qpeg
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
Real programmers don't comment their code, it was hard to write, it should be hard to understand
dalleboy
dalleboy
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|C++ library of container classes, algorithms and iterators. It provides many of the basic algorithms and data structures of computer science." target="_blank">STL Programmer''s Guide|C++ Style and Technique FAQ - Designer and implementor the C++ programming language." target="_blank">Bjarne FAQ|C++ FAQ Lite - Frequently Asked Questions about the C++ language." target="_blank">C++ FAQ Lite|C++ Reference - The standard C++ library is a collection of functions, constants, classes and objects that extends the C++ language providing basic functionality to interact with the operating system and some standard classes, objects and algorithms that may be commonly needed." target="_blank">C++ Reference|MSDN]
Qpeg
Qpeg
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
Real programmers don't comment their code, it was hard to write, it should be hard to understand

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.