From 019567b10d338d2b7431c61432b67ce37f10490f Mon Sep 17 00:00:00 2001 From: Quantum Date: Mon, 14 Apr 2014 20:51:57 -0400 Subject: [PATCH] Fixed DC eating --- src/PianoControl.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/PianoControl.cpp b/src/PianoControl.cpp index 89f774b..bdcb5e3 100644 --- a/src/PianoControl.cpp +++ b/src/PianoControl.cpp @@ -473,7 +473,8 @@ void PianoControl::OnPaint() hMemDC = CreateCompatibleDC(hdc); if (!hMemBitmap || cx > bmx || cy > bmy) { if (hMemBitmap) - DeleteObject(hMemBitmap); + if (!DeleteObject(hMemBitmap)) + MessageBox(m_hwnd, L"FAILED TO DELETE BITMAP", NULL, 0); bmx = cx + 50; bmy = cy + 50; hMemBitmap = CreateCompatibleBitmap(hdc, bmx, bmy); @@ -488,6 +489,7 @@ void PianoControl::OnPaint() BitBlt(hdc, x, y, cx, cy, hMemDC, x, y, SRCCOPY); SelectObject(hMemDC, hbmPrev); + ps.hdc = hdc; } else PaintContent(&ps); EndPaint(m_hwnd, &ps);