Jump to content
  • Advertisement
Sign in to follow this  
Hassanbasil

window borders thickness

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

Hello everyone, Im trying to find out the correct window border thickness using windows API, but i dont seem to find a way to do it, for example, to get the caption thockness i use GetSystemMetrics ( SM_CYCAPTION ), it returns 20, when the actual caption thickness is 30 ( tested it with the mouse pos, seems to be 30. ), same with borders, how can i get the correct values?

Share this post


Link to post
Share on other sites
Advertisement
i want it because, when i create a window, i specify a height and a width, and i use the same values for the directX backbuffer width/height, so it gets some kind of "stretched" because the window client rect is width-border*2 and height-caption-border, so window rect is smaller than the backbuffer, i think you got the point? (tho i might be wrong with something there, but adding the borders thickness in addition to the width/height when creating window solves the problem ) ( not sure if AdjustWindowRect is what im looking for, unless i used it in a wrong way? )

Share this post


Link to post
Share on other sites
After you created the Window, you can use GetClientRect(HWND window,rect* R) to get the rect of the client area of your window. (As the function says ;) )

That excludes the Borders and Menu bar, and is just perfect for that!

Note, that the left and top side of your rect will always be 0, so you have to use just the Right and Bottom. They hold the size of your client area.

Share this post


Link to post
Share on other sites
problem's that i dont want the width/height parameters for the window, i want them for the client area, so if i create the window with the parameters, the client area will be smaller, and thus the directx backbuffer will also get stretched, which is not what im looking for, which brings us back to the first question, how to get the border's thickness of a window?

Share this post


Link to post
Share on other sites
AdjustWindowRectEx is exactly what you want then:
Quote:
The AdjustWindowRectEx function calculates the required size of the window rectangle, based on the desired size of the client rectangle. The window rectangle can then be passed to the CreateWindowEx function to create a window whose client area is the desired size.

EDIT: Too slow...

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!