diff options
| author | Pietro Gagliardi <[email protected]> | 2014-08-25 01:49:11 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-08-25 01:49:11 -0400 |
| commit | 2c26f3e4ca3d382b92d752c1c61f74dac6cdfc74 (patch) | |
| tree | 87c92ae9cb809205627c7303b4ede80a3c6e7602 /redo/imagelist_windows.c | |
| parent | 95c42353fb9e5fd34ca7d1887dde62e0a8ca2158 (diff) | |
Added code for printing HRESULTs on Windows. (There is no HRESULT-to-string function because HRESULTs were designed to be extensible in vendor-specific ways.)
Diffstat (limited to 'redo/imagelist_windows.c')
| -rw-r--r-- | redo/imagelist_windows.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/redo/imagelist_windows.c b/redo/imagelist_windows.c index a3ebf97..ef6d334 100644 --- a/redo/imagelist_windows.c +++ b/redo/imagelist_windows.c @@ -193,10 +193,13 @@ static HTHEME theme = NULL; static void openTheme(HWND hwnd) { - if (theme != NULL) - // TODO save HRESULT - if (CloseThemeData(theme) != S_OK) - xpanic("error closing theme", GetLastError()); + HRESULT res; + + if (theme != NULL) { + res = CloseThemeData(theme); + if (res != S_OK) + xpanichresult("error closing theme", res); + } // ignore error; if it can't be done, we can fall back to DrawFrameControl() theme = OpenThemeData(hwnd, L"button"); } @@ -215,10 +218,11 @@ static int themestates[checkboxnStates] = { static SIZE getStateSize(HDC dc, int cbState) { SIZE s; + HRESULT res; - // TODO use HRESULT - if (GetThemePartSize(theme, dc, BP_CHECKBOX, themestates[cbState], NULL, TS_DRAW, &s) != S_OK) - xpanic("error getting theme part size", GetLastError()); + res = GetThemePartSize(theme, dc, BP_CHECKBOX, themestates[cbState], NULL, TS_DRAW, &s); + if (res != S_OK) + xpanichresult("error getting theme part size", res); return s; } @@ -230,6 +234,7 @@ static HBITMAP drawThemeImage(HDC dc, int width, int height, int cbState) RECT r; HDC drawDC; HBITMAP prevbitmap; + HRESULT res; r.left = 0; r.top = 0; @@ -253,9 +258,9 @@ static HBITMAP drawThemeImage(HDC dc, int width, int height, int cbState) prevbitmap = SelectObject(drawDC, bitmap); if (prevbitmap == NULL) xpanic("error selecting checkbox image list bitmap into DC", GetLastError()); - // TODO get HRESULT - if (DrawThemeBackground(theme, drawDC, BP_CHECKBOX, themestates[cbState], &r, NULL) != S_OK) - xpanic("error drawing checkbox image", GetLastError()); + res = DrawThemeBackground(theme, drawDC, BP_CHECKBOX, themestates[cbState], &r, NULL); + if (res != S_OK) + xpanichresult("error drawing checkbox image", res); if (SelectObject(drawDC, prevbitmap) != bitmap) xpanic("error selecting previous bitmap into checkbox image's DC", GetLastError()); if (DeleteDC(drawDC) == 0) |
