From 21e96c692595f204b91431a90123419e4a1780c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Fri, 22 Jul 2022 23:52:22 +0200 Subject: Cache GetSystemMetrics values with variable template. The variable template could be generalized like this: template const auto cache = F(A...); and instantiated like: cache It would still be limited to constant function arguments, which usually isn't a problem for GetSystemMetrics, but might be for other functions. --- c/main.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'c/main.cpp') diff --git a/c/main.cpp b/c/main.cpp index 5a33405..c04890d 100644 --- a/c/main.cpp +++ b/c/main.cpp @@ -18,7 +18,6 @@ int g_bThread; /* Looked-up constants. */ int g_bThemes; -int g_cxVScroll; int g_iDPI = 96; /* Fonts. */ @@ -166,8 +165,6 @@ static LRESULT CALLBACK CBTProc(const int nCode, const WPARAM wParam, const LPAR g_hWnd = (HWND)wParam; /* Look up constants. */ - g_cxVScroll = GetSystemMetrics(SM_CXVSCROLL); - if (auto opLib = maybe_make(TEXT("User32.dll"))) if (auto GetDpiForWindow = opLib->GetProcAddress("GetDpiForWindow")) g_iDPI = GetDpiForWindow(g_hWnd); -- cgit v1.2.3