Jump to content
  • Advertisement

Archived

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

Lalle

Get mouse current position

This topic is 6203 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

Is there another way to get the mouse currently position and status than using WM_ messages, like a function? Lalle

Share this post


Link to post
Share on other sites
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!"

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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!