Skip to content

Instantly share code, notes, and snippets.

@lyf-is-coding
Created September 8, 2022 12:38
Show Gist options
  • Save lyf-is-coding/e7a5b64ddc737130d8c3302eb9976f52 to your computer and use it in GitHub Desktop.
Save lyf-is-coding/e7a5b64ddc737130d8c3302eb9976f52 to your computer and use it in GitHub Desktop.
C++ Getting window width and height using GetClientRect
#include <Windows.h>
bool GetWndWidthHeight(const HWND& hwnd, long* wnd_width, long* wnd_height)
{
RECT rct;
if (!GetClientRect(hwnd, &rct))
{
return false;
}
*wnd_width = rct.right;
*wnd_height = rct.bottom;
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment