How to create a window based only on screen size, not including the border of the window with C ++ / Windows?

When creating a window using CreateWindow(...)that requires the width and height of the window, I need to enter values ​​of 656 and 516 instead of 640 and 480 to take into account the borders of the windows.

I am wondering if there is a way to create a window based only on the part of the window that does not include the border, especially considering that if different versions of windows have different size boundaries, than the program can be displayed differently when I run it in different versions

(that is: using 640 - object.width places the object not quite on the edge of the screen if the user version of the windows has borders of different sizes).

So, is there a way to create a window based only on the part of the screen that is relevant to the program, or at least on the function along the lines of GetVericalBorder()/ GetHorizontalBorder(), so that I use them in CreateWindow()place of arbitrary and undefined values, such as 656 and 516?

+3
source share
3 answers

See AdjustWindowRectEx . You pass this function a rectangle containing the desired size of the client area of ​​your window and window style flags, and it calculates how large the overall window is to make the client area be the desired size.

+3
source

API SystemParametersInfo() . . SPI_GETBORDER / SPI_GETNONCLIENTMETRICS Microsoft Library

SystemParametersInfo , ..

+2
int WINAPI GetSystemMetrics(
  __in  int nIndex
);

Contact Microsoft Library

0
source

Source: https://habr.com/ru/post/1734816/


All Articles