Files

12 lines
396 B
C
Raw Permalink Normal View History

2025-11-06 01:00:40 +08:00
#include <c_WinGuiUtil.h>
void c_WinGuiUtil_MoveWindowToScreenCenter(HWND hwnd){
int width = GetSystemMetrics(SM_CXSCREEN);
int height = GetSystemMetrics(SM_CYSCREEN);
RECT Rect;
GetWindowRect(hwnd, &Rect);
int x = (width - (Rect.right - Rect.left))/2;
int y = (height - (Rect.bottom - Rect.top))/2;
SetWindowPos(hwnd, NULL, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
}