Fixed DC eating

This commit is contained in:
Quantum 2014-04-14 20:51:57 -04:00
parent 2ca1d5a9d3
commit 019567b10d

View file

@ -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);