Jump to content
  • Advertisement

Archived

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

dr_slash_uh

Windows size and Screen size

This topic is 5292 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 was wondering if someone can tell me how to find the actual size of the of the client area of a window using opengl. I set the window size to 800X600 but when i use the mouse to capture the coordinates it becomes 791x553. Is there a formula I must use to figure it out. I do have a menu bar that is taking away from some of the height though. Thanks

Share this post


Link to post
Share on other sites
Advertisement
GetClientRect()

assuming you're using windows of course. Unless I've gotten my functions twisted, GetWindowRect is the size of the window, GetClientRect gets the size of the window you can actually draw on.

[edit] figured I'd be more helpful and show usage too:
RECT clientRect;
GetClientRect(hWnd,&clientRect);

-Arek the Absolute

[edited by - Arek the Absolute on March 29, 2004 9:02:47 PM]

Share this post


Link to post
Share on other sites
Arek is correct. Note that the dimensions you pass to the window creation procedure set the window size, not the client area (the region you draw on) size.

To obtain a client area of specific dimensions, use AdjustWindowRect before calling CreateWindow[Ex].

Share this post


Link to post
Share on other sites
Ok, one more question. Is there a book I could purchase that has every win32 function listed, like a reference book. Preferbly a noob book.

Share this post


Link to post
Share on other sites
If you absolutely want a book, though, pick the appropriate version of Charles Petzold''s Programming Windows X (replace X with your target - Me, XP, 2000, 98, etc) series.

Share this post


Link to post
Share on other sites
One other note .. GetWindowRect returns the coords of the window in screen (desktop) space, while GetClientRect returns coords relative to the window (ie. upper left always 0,0)

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!