I started a new Windows Desktop C++ project in Visual Studio. The window creation looks like this:
HWND hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr);
Immediately I check the size of the window and client rects, and get the difference between them:
RECT windowRect;
RECT clientRect;
GetWindowRect(hWnd, &windowRect);
GetClientRect(hWnd, &clientRect);
int xExtra = windowRect.right - windowRect.left - clientRect.right;
xExtra
is 16 (26 if my process is per monitor DPI aware).
What is accounting for this difference? The client area appears to be the same width as the window!
(It seems like the border may account for a few pixels, but not 26!)
What am I overlooking?