Jump to content
  • Advertisement
Sign in to follow this  
SelethD

How to obtain correct mouse coordinates

This topic is 4831 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 have an app that is in windowed mode. Im using the commands... POINT p; GetCursorPos(&p); to get the cursor position, however its giving me the position relative to the top left corner of the desktop, not the top left corner of my app's window. So I tried this RECT WindowBounds; GetWindowRect(hWnd, &WindowBounds ); POINT p; GetCursorPos(&p) p.x = p.x - WindowBounds.left; p.y = p.y - WindowBounds.top; This almost gives me the correct mouse coords execpt that its still off by the width of the app window's title bar, in the y value and the app window's left border width in the x value. So is there any way of obtaining the heigth of the window title bar, and the width of the left border? Or is there just an easier way of doing this altogether? Thanks im using VC.net with winXP Thanks

Share this post


Link to post
Share on other sites
Advertisement
Will that affect the coords if im in full screen mode?

Like, can I put that in my mouse class and whether im in windowed or full screen will it give the correct coords?


and thanks for the quick reply.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!