C ++でwin32でプロジェクトを実行し、描画中の画像をダブルバッファリングしようとしていますが、正しいビットマップが描画された黒い画面が表示されます。これは、カーソルとともにビットマップをドラッグしてビットマップを描画しない WM_MOUSEMOVE 状態も引き起こしています。ペイントのコードは次のとおりです。paint() は WM_PAINT の下の wndproc で呼び出されます。scroll はスクロール バーの位置で、これまでは使用されていません。
int paint(HWND hWnd, HINSTANCE hInst, RECT clientRect, std::vector<Measure> *measures, int scroll)
{
int x = 90;
hdc = BeginPaint(hWnd, &ps);
hdcmem = CreateCompatibleDC(hdc);
HBITMAP hbmScreen = CreateCompatibleBitmap(hdc, clientRect.right, clientRect.bottom);
SelectObject(hdcmem,hbmScreen);
/*these functions just create the bitmaps into hdcmem*/
drawStaff(hWnd, hInst, clientRect, x, 0);
drawKey(hWnd, hInst, clientRect, x, (*measures)[0], 0);
drawTime(hWnd, hInst, clientRect, x, (*measures)[0], 0);
drawNotes(hWnd, hInst, clientRect, measures, x);
BitBlt(hdc, 0, 0, clientRect.right, clientRect.bottom, hdcmem, 0, 0, SRCCOPY);
ReleaseDC(hWnd, hdcmem);
return 0;
}