From edce20642b6d177ee9877775cbfa9e05ebb4e404 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Tue, 2 Aug 2022 23:31:21 +0200 Subject: Replace maybe_make. It seems unnecessary to throw exceptions when simply checking whether a library exists. --- c/main.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'c/main.cpp') diff --git a/c/main.cpp b/c/main.cpp index d76225e..32187c8 100644 --- a/c/main.cpp +++ b/c/main.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -165,16 +166,16 @@ static LRESULT CALLBACK CBTProc(const int nCode, const WPARAM wParam, const LPAR g_hWnd = (HWND)wParam; /* Look up constants. */ - if (auto lib = maybe_make(L"User32.dll"); + if (auto lib = Library::Maybe(L"User32.dll"); auto GetDpiForWindow = lib->GetProcAddress("GetDpiForWindow")) g_dpi = GetDpiForWindow(g_hWnd); - if (auto lib = maybe_make(L"uxtheme.dll"); + if (auto lib = Library::Maybe(L"uxtheme.dll"); lib->GetProcAddress("SetWindowTheme")) g_bThemes = 1; - if (auto lib = maybe_make(L"User32.dll"); - lib->GetProcAddress("SystemParametersInfo" WA)) { + if (auto lib = Library::Maybe(L"User32.dll"); + lib->GetProcAddress("SystemParametersInfoW")) { NONCLIENTMETRICS m; m.cbSize = sizeof(NONCLIENTMETRICS); require(SystemParametersInfo(SPI_GETNONCLIENTMETRICS, -- cgit v1.2.3