aboutsummaryrefslogtreecommitdiff
path: root/c/main.cpp
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-07-26 18:51:15 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-07-26 18:51:15 +0200
commitdccea47e9bc322d654902a1db4fc52cbf6dd0cd7 (patch)
treedebae66516428387003c2eb1cf0142e1f4b33e2e /c/main.cpp
parentbb772c84c02aab0a918ed723390c6af79a2e45e8 (diff)
downloadEpisodeBrowser-dccea47e9bc322d654902a1db4fc52cbf6dd0cd7.tar.gz
Improve Win32Error, library handling code.
Diffstat (limited to 'c/main.cpp')
-rw-r--r--c/main.cpp31
1 files changed, 15 insertions, 16 deletions
diff --git a/c/main.cpp b/c/main.cpp
index 057bf32..2037578 100644
--- a/c/main.cpp
+++ b/c/main.cpp
@@ -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)));