Get mouse current position

Started by
2 comments, last by Lalle 22 years, 8 months ago
Is there another way to get the mouse currently position and status than using WM_ messages, like a function? Lalle
Advertisement
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!"
- The Goblin (madgob@aol.com)
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 windowScreenToClient(hwnd, &curr_pos); // convert screen coordinates to window coordinates  


As you might expect, there''s also a SetCursorPos.
Thanks alot you guys :-)


Lalle

This topic is closed to new replies.

Advertisement