Archived

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

Lalle

Get mouse current position

Recommended Posts

What''s wrong with WM_ messages? You could always use DirectInput, but somehow I doubt that''s what you want...

I''m not sure if there''s a specific function for it, like there is GetAsyncKeyState(...). Maybe somebody more familiar with the Win32 API could help out?

-----------------
The Goblin (madgob@aol.com)
-----------------
"Before critisizing somebody, walk a mile in their shoes. That way, when you do critisize them, not only will you be a mile away, but you''ll also have their shoes!"

Share this post


Link to post
Share on other sites
Unless you need automatic buffering, using the API is just fine, and DirectInput is just not worth the trouble. Use GetCursorPos to get the mouse''s position in screen coordinates. For example:

  
RECT curr_pos;
GetCursorPos(&curr_pos);

// hwnd is the handle to the main window

ScreenToClient(hwnd, &curr_pos); // convert screen coordinates to window coordinates



As you might expect, there''s also a SetCursorPos.

Share this post


Link to post
Share on other sites