aboutsummaryrefslogtreecommitdiff
path: root/c/listview.cpp
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-07-19 17:26:24 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-07-19 17:26:24 +0200
commitff53b8efce55f5668af61f13b656fdb54dee7755 (patch)
tree3b5802f9a1ac2b5bc7b32578528659a70c4c1b4c /c/listview.cpp
parent0635058400597e43d698c87caf3d3ca4f802e0bd (diff)
downloadEpisodeBrowser-ff53b8efce55f5668af61f13b656fdb54dee7755.tar.gz
Check Windows API calls for errors more consistently.
Some of the checks are likely redundant, but the Windows API documentation rarely makes it clear WHICH errors may be returned (and under which circumstances) rather than simply WHETHER errors may be returned (under any circumstances, including those that do not apply in the given case).
Diffstat (limited to 'c/listview.cpp')
-rw-r--r--c/listview.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/c/listview.cpp b/c/listview.cpp
index 8f5da65..fa99793 100644
--- a/c/listview.cpp
+++ b/c/listview.cpp
@@ -13,16 +13,15 @@ ListView::ListView(const HWND hWndParent, const HMENU hMenu, const DWORD dwStyle
{
m_hWndParent = hWndParent;
m_bHeader = !(dwStyle & LVS_NOCOLUMNHEADER);
- hWnd = CreateWindowEx(
+ hWnd = throw_nil<CreateWindowEx>(
WS_EX_CLIENTEDGE,
WC_LISTVIEW,
TEXT(""),
dwStyle|WS_CHILD|WS_VISIBLE|WS_VSCROLL|WS_TABSTOP|LVS_REPORT|LVS_SHOWSELALWAYS,
0, 0, 0, 0,
m_hWndParent, hMenu, GetModuleHandle(NULL), this);
- if (!hWnd) throw Win32Error(GetLastError());
- if (SetProp(hWnd, TEXT("this"), (HANDLE)this))
+ if (throw_nil<SetProp>(hWnd, TEXT("this"), (HANDLE)this))
m_prevProc = (WNDPROC)SetWindowLongPtr(hWnd,
GWLP_WNDPROC, (LONG_PTR)::WndProc);