Jump to content
  • Advertisement
Sign in to follow this  
stenny

Window size (WINAPI) includes blue bar

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

Hey there! Apparently the width and height you give up when creating a window (CreateWindowEx) include that titlebar on top of your window. I find this very annoying, because it gives pixelcalculationproblems in my games. Is there a way around? Lots of thanks, -Stijn

Share this post


Link to post
Share on other sites
Advertisement
Or you could use the GetSystemMetrics function in order to find the width and height of window titlebars and borders, then take those values into consideration when creating your window.

Share this post


Link to post
Share on other sites
I find that AdjustWindowRect is more exact. With GetSystemMetrics I always seem to be 2 pixels too long both on height and width.

Share this post


Link to post
Share on other sites
Aah, thanks mates! Those should do the trick :) I think I'll go with AdjustWindowRect.

[EDIT]
Which style should I put in if my window's created with WS_OVERLAPPEDWINDOW? If I use WS_OVERLAPPEDWINDOW, the return height is too big (displaying a 640*480 pic in the background and there's room left at the bottom).

[Edited by - stenny on July 13, 2008 5:31:16 PM]

Share this post


Link to post
Share on other sites
Hi, make sure that the style parameter in AdjustWindowRect matchs the one in CreateWindowEx, i use the function and no problem so far.

though personally i use CreateWindow

Share this post


Link to post
Share on other sites
Quote:
Original post by Noplace
though personally i use CreateWindow

CreateWindow() merely calls CreateWindowEx() with the first parameter set to 0, so it's all the same really.

Share this post


Link to post
Share on other sites
Quote:
Original post by RandomPixel
I find that AdjustWindowRect is more exact. With GetSystemMetrics I always seem to be 2 pixels too long both on height and width.

You may be forgetting to take into account the width of the window border, which can also be queried with GetSystemMetrics().

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!