aboutsummaryrefslogtreecommitdiff
path: root/c/window.h
diff options
context:
space:
mode:
Diffstat (limited to 'c/window.h')
-rw-r--r--c/window.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/c/window.h b/c/window.h
index daf7202..9d247ec 100644
--- a/c/window.h
+++ b/c/window.h
@@ -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);