diff options
author | John Ankarström <john@ankarstrom.se> | 2022-08-02 23:31:21 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-08-02 23:31:21 +0200 |
commit | edce20642b6d177ee9877775cbfa9e05ebb4e404 (patch) | |
tree | f37c2d7121b3de0491561a5bd33ecf004d3a67d2 /c/main.cpp | |
parent | ad4a1e4ac6b9452bb28936623035d01bb03f36f2 (diff) | |
download | EpisodeBrowser-edce20642b6d177ee9877775cbfa9e05ebb4e404.tar.gz |
Replace maybe_make.
It seems unnecessary to throw exceptions when simply checking whether
a library exists.
Diffstat (limited to 'c/main.cpp')
-rw-r--r-- | c/main.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -1,4 +1,5 @@ #include <exception> +#include <stdexcept> #include <windows.h> #include <commctrl.h> #include <uxtheme.h> @@ -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<Library>(L"User32.dll"); + if (auto lib = Library::Maybe(L"User32.dll"); auto GetDpiForWindow = lib->GetProcAddress<UINT(HWND)>("GetDpiForWindow")) g_dpi = GetDpiForWindow(g_hWnd); - if (auto lib = maybe_make<Library>(L"uxtheme.dll"); + if (auto lib = Library::Maybe(L"uxtheme.dll"); lib->GetProcAddress<void>("SetWindowTheme")) g_bThemes = 1; - if (auto lib = maybe_make<Library>(L"User32.dll"); - lib->GetProcAddress<void>("SystemParametersInfo" WA)) { + if (auto lib = Library::Maybe(L"User32.dll"); + lib->GetProcAddress<void>("SystemParametersInfoW")) { NONCLIENTMETRICS m; m.cbSize = sizeof(NONCLIENTMETRICS); require(SystemParametersInfo(SPI_GETNONCLIENTMETRICS, |