Created
September 8, 2022 12:38
-
-
Save lyf-is-coding/e7a5b64ddc737130d8c3302eb9976f52 to your computer and use it in GitHub Desktop.
C++ Getting window width and height using GetClientRect
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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