..
#gamedev

GetClientRect - Retrieve Window Size in Windows

Table of Contents

The way to retrieve the window size in Windows API is through the GetClientRect.

This functions retrieves the coordinates of a window's client area. That means an area that we actually can draw into, without border, menus and anything else outside users (client) interaction.

See some example:

RECT rect;
GetClientRect(window, &rect);
int width  = rect.right  - rect.left;
int height = rect.bottom - rect.top;

References