Jump to content
  • Advertisement
Sign in to follow this  
RogerThat123

Window Dimensions?

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

How can I get the window dimensions of a window. By this I mean the outer edge of the window, ex ( the left edge of the window is 10 pixels, the top window bar in height is 40 pixels ) these are just guesses. I need because the way I get my mouse position is based on the top left of the inside of the windows interface (not including) meaning when Im reading the pixel colors (0,0) to me is inside the window and to GetPixel its the top left of the window and a completely different color is sent to me. Anyone know how I can get the dimensions? Would help a ton. Thank you

Share this post


Link to post
Share on other sites
Advertisement
I'm assuming C++? Windows?


//POINT mouseCoords
GetCursorPos(mouseCoords);

ScreenToClient(handleWnd, &mouseCoords);
RECT prect;
GetClientRect(handleWnd, &prect);
mouseCoords.x += (SCREEN_WIDTH - prect.right);
mouseCoords.y += (SCREEN_HEIGHT - prect.bottom);

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!