Skip to content

Commit a3127c4

Browse files
authored
📰 Update to v1.0.1
Fixed : Correct window scaling on high-DPI monitors. Previously the UI elements scaled properly, but the window’s physical size remained fixed at 465 × 240 px, causing the content to look oversized. The window now calculates its size via MulDiv(base_size, DPI, 96) before creation, ensuring the correct physical pixel dimensions on any DPI setting.
1 parent fa46783 commit a3127c4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

WindowsUpdatePauser.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,14 +629,21 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi
629629
return 1;
630630
}
631631

632+
UINT dpi = 96;
633+
HMONITOR hMon = MonitorFromPoint({}, MONITOR_DEFAULTTOPRIMARY);
634+
GetDpiForMonitor(hMon, MDT_EFFECTIVE_DPI, &dpi, &dpi);
635+
636+
int scaledWidth = MulDiv(WINDOW_WIDTH, dpi, 96);
637+
int scaledHeight = MulDiv(WINDOW_HEIGHT, dpi, 96);
638+
632639
// Create main window
633640
HWND hWnd = CreateWindowExW(
634641
0,
635642
CLASS_NAME,
636643
L"Windows Update Pauser",
637644
WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX,
638645
CW_USEDEFAULT, CW_USEDEFAULT,
639-
Scale(WINDOW_WIDTH), Scale(WINDOW_HEIGHT),
646+
scaledWidth, scaledHeight,
640647
nullptr, nullptr, hInstance, nullptr
641648
);
642649

0 commit comments

Comments
 (0)