From 279b0c7764c3e49db72606c25dd7151137d66b70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sat, 2 Apr 2022 23:57:16 +0200 Subject: Move initialization to WM_CREATE. WM_CREATE is sent as soon as the window is created. This means that it is not a good idea to set window-specific variables in the code following CreateWindow. Instead, they should be set in the window procedure's response to WM_CREATE. --- c/common.c | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'c/common.c') diff --git a/c/common.c b/c/common.c index 7ee27ff..a056993 100644 --- a/c/common.c +++ b/c/common.c @@ -4,26 +4,6 @@ #include "resource.h" #include "defs.h" -/* Scale integer according to DPI. */ -int Dpi(int i) -{ - extern int IDPI; - - if (IDPI == -1) { - HMODULE hModule; - FARPROC GetDpiForWindow; - extern HWND HWnd; - IDPI = 96; - hModule = LoadLibrary(TEXT("User32.dll")); - if (hModule && (GetDpiForWindow = GetProcAddress(hModule, "GetDpiForWindow"))) { - IDPI = GetDpiForWindow(HWnd); - FreeLibrary(hModule); - } - } - - return MulDiv(i, IDPI, 96); -} - /* Convert normal string to TSTR using given codepage. */ TCHAR * TszFromSz(const char *sz, int iCp) -- cgit v1.2.3