aboutsummaryrefslogtreecommitdiff
path: root/c/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'c/main.c')
-rw-r--r--c/main.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/c/main.c b/c/main.c
index 2adb2f2..eaca8f3 100644
--- a/c/main.c
+++ b/c/main.c
@@ -61,7 +61,6 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
tszErr = TEXT("Could not register window class.");
if (!RegisterClassEx(&wc)) goto f;
-
/* Create window. */
hWnd = CreateWindowEx(
@@ -74,8 +73,6 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
);
tszErr = TEXT("Could not create main window.");
if (!hWnd) goto f;
- SetWindowPos(hWnd, NULL, -1, -1, Dpi(510), Dpi(400), SWP_NOMOVE);
- SetupFonts();
ShowWindow(hWnd, nCmdShow);
while (GetMessage(&msg, NULL, 0, 0) > 0) {
@@ -95,6 +92,26 @@ LRESULT CALLBACK
WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg) {
+ case WM_CREATE:
+ {
+ HMODULE hModule;
+ FARPROC GetDpiForWindow;
+ extern HWND HWnd, HElv;
+ HWnd = hWnd;
+ IDPI = 96;
+ hModule = LoadLibrary(TEXT("User32.dll"));
+ if (hModule && (GetDpiForWindow = GetProcAddress(hModule, "GetDpiForWindow"))) {
+ IDPI = GetDpiForWindow(HWnd);
+ FreeLibrary(hModule);
+ }
+ SetWindowPos(hWnd, NULL, -1, -1, Dpi(510), Dpi(400), SWP_NOMOVE);
+ SetupFonts();
+ DlvCreate();
+ ElvCreate();
+ UpdateTheme();
+ SetFocus(HElv);
+ break;
+ }
case WM_CLOSE:
DestroyWindow(hWnd);
break;
@@ -111,16 +128,6 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
lpMMI->ptMinTrackSize.y = LvHeight(HDlv)+80;
break;
}
- case WM_CREATE:
- {
- extern HWND HElv;
- HWnd = hWnd;
- DlvCreate();
- ElvCreate();
- UpdateTheme();
- SetFocus(HElv);
- break;
- }
case WM_THEMECHANGED:
UpdateTheme();
break;