diff options
author | John Ankarström <john@ankarstrom.se> | 2022-09-07 00:40:26 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-09-07 00:40:26 +0200 |
commit | 2f7b69d6d4cf18ca9ca04d9a44aaa6871ce51160 (patch) | |
tree | d016a9456621b91ca902f0c1caf48468e899a553 /c/window.h | |
parent | 5b1a07607ba593050e37598f731f833b6faabee4 (diff) | |
download | EpisodeBrowser-2f7b69d6d4cf18ca9ca04d9a44aaa6871ce51160.tar.gz |
Improve error handling.
Diffstat (limited to 'c/window.h')
-rw-r--r-- | c/window.h | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -15,7 +15,15 @@ struct Window HWND hWnd; HWND hWndFocus = nullptr; HWND hWndStatus = nullptr; - HMENU hMenuPopup = Require(GetSubMenu(Require(LoadMenuW(nullptr, MAKEINTRESOURCE(IDR_POPUPMENU))), 0)); + const HMENU hMenuPopup = []() + { + HMENU hm; + if (!(hm = LoadMenuW(nullptr, MAKEINTRESOURCE(IDR_POPUPMENU)))) + throw Err(WINDOWS, L"Context menu could not be loaded: %s"); + if (!GetSubMenu(hm, 0)) + throw Err(WINDOWS, L"Submenu could not be retrieved: %s"); + return hm; + }(); /* File views. */ FileView<CfgA> fvCfg = FileView<CfgA>::Initialized(L"cfg.dat", 1); |