Using the WinApi GetWindowRect() it returns the complete window size, but I would like to get the size without the borders and the title bar, something like the red square:

There is any functions to do that?
Thanks
The Windows API function you are looking for is GetClientRect. If you subsequently need to convert these coordinates into screen relative coordinates, call ClientToScreen.
This works:
RECT getInnerWindowScreenRectangle(HWND window) {
    RECT client;
    RECT output;
    // client coordinates are (0, 0) in the top left corner
    // of the window inside the border.
    GetClientRect(window, &client);
    POINT point;
    point.x = 0;
    point.y = 0;
    // screen coordinates are virtual screen coordinates with (0, 0)
    // in the top left corner of the primary display.
    ClientToScreen(window, &point);
    output.left = point.x;
    output.top = point.y;
    output.right = point.x + client.right;
    output.bottom = point.y + client.bottom;
    return output;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With