Window border width and height

I am writing a direct3d application and I notice strange errors like anti-aliasing happening even when it was turned off and the mouse pointer was not queuing up with things with the same coordinates as myself, I found that when creating a window, the width and heights include the border. The program was outputting 800x600 graphics output to a window of the same size, but due to the borders it was curled into a 792x566 rectangle. I have increased the size of the window to compensate, but it won't work if the system uses a border style other than the standard XP style. (For example, classic style)

Is there a way to find out what the width and height of the border is before I create the window?

+1


source to share


2 answers


It looks like you are looking for the GetSystemMetrics function. For example, the border width in pixels is returned

GetSystemMetrics(SM_CXBORDER)

      



ADDED: . For the overall size, you will need to add different "parts" of the non-client area: borders, frame sizes, headers, etc.

+2


source


Another option is to ensure that the D3D surface is the same size as the client rectangle ( GetClientRect () ). Then you know that you will display the appropriate size and you don't have to worry about menu widths, borders, etc.



+3


source







All Articles