diff options
author | John Ankarström <john@ankarstrom.se> | 2022-07-26 18:51:15 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-07-26 18:51:15 +0200 |
commit | dccea47e9bc322d654902a1db4fc52cbf6dd0cd7 (patch) | |
tree | debae66516428387003c2eb1cf0142e1f4b33e2e /c/main.cpp | |
parent | bb772c84c02aab0a918ed723390c6af79a2e45e8 (diff) | |
download | EpisodeBrowser-dccea47e9bc322d654902a1db4fc52cbf6dd0cd7.tar.gz |
Improve Win32Error, library handling code.
Diffstat (limited to 'c/main.cpp')
-rw-r--r-- | c/main.cpp | 31 |
1 files changed, 15 insertions, 16 deletions
@@ -167,22 +167,21 @@ static LRESULT CALLBACK CBTProc(const int nCode, const WPARAM wParam, const LPAR g_hWnd = (HWND)wParam; /* Look up constants. */ - if (auto opLib = maybe_make<Library>(TEXT("User32.dll"))) - if (auto GetDpiForWindow = opLib->GetProcAddress<UINT(HWND)>("GetDpiForWindow")) - g_iDPI = GetDpiForWindow(g_hWnd); - - if (auto opLib = maybe_make<Library>(TEXT("uxtheme.dll"))) - if (opLib->GetProcAddress<void>("SetWindowTheme")) - g_bThemes = 1; - - if (auto opLib = maybe_make<Library>(TEXT("User32.dll"))) { - if (opLib->GetProcAddress<void>("SystemParametersInfo" WA)) { - NONCLIENTMETRICS m; - m.cbSize = sizeof(NONCLIENTMETRICS); - require(SystemParametersInfo(SPI_GETNONCLIENTMETRICS, - sizeof(NONCLIENTMETRICS), &m, 0)); - g_hfNormal = require(CreateFontIndirect(&m.lfMessageFont)); - } + if (auto opLib = maybe_make<Library>(TEXT("User32.dll")); + auto GetDpiForWindow = opLib->GetProcAddress<UINT(HWND)>("GetDpiForWindow")) + g_iDPI = GetDpiForWindow(g_hWnd); + + if (auto opLib = maybe_make<Library>(TEXT("uxtheme.dll")); + opLib->GetProcAddress<void>("SetWindowTheme")) + g_bThemes = 1; + + if (auto opLib = maybe_make<Library>(TEXT("User32.dll")); + opLib->GetProcAddress<void>("SystemParametersInfo" WA)) { + NONCLIENTMETRICS m; + m.cbSize = sizeof(NONCLIENTMETRICS); + require(SystemParametersInfo(SPI_GETNONCLIENTMETRICS, + sizeof(NONCLIENTMETRICS), &m, 0)); + g_hfNormal = require(CreateFontIndirect(&m.lfMessageFont)); } else g_hfNormal = static_cast<HFONT>(require(GetStockObject(DEFAULT_GUI_FONT))); |