Hi,
Can anyone plz help?
I have the following code for the WM_PAINT event, but it doesn't work. Need to knw why. I'm drawing the scene to the window, but am using an intermediate DC. Then it just shows a white screen, however, if I drop the intermediate DC, it works. I need to know why this fails. Thanks in advance.
Can anyone plz help?
I have the following code for the WM_PAINT event, but it doesn't work. Need to knw why. I'm drawing the scene to the window, but am using an intermediate DC. Then it just shows a white screen, however, if I drop the intermediate DC, it works. I need to know why this fails. Thanks in advance.
Code:
case WM_PAINT:
{
HBITMAP hBm = (HBITMAP)LoadImageA(NULL, "black.bmp", IMAGE_BITMAP, 768, 768, LR_LOADFROMFILE);
HBITMAP hBmMask = (HBITMAP)LoadImageA(NULL, "blackm.bmp", IMAGE_BITMAP, 768, 768, LR_LOADFROMFILE);
HDC ourDC = CreateCompatibleDC(GetDC(hWnd));
HDC comDC = CreateCompatibleDC(ourDC);
HDC mDC = CreateCompatibleDC(ourDC);
HBITMAP old = (HBITMAP)SelectObject(comDC, hBm);
HBITMAP old2 = (HBITMAP)SelectObject(mDC, hBmMask);
BitBlt(ourDC, 0, 0, 768, 768, mDC, 0, 0, SRCAND);
BitBlt(ourDC, 0, 0, 768, 768, comDC, 0, 0, SRCPAINT);
BitBlt(GetDC(hWnd), 0, 0, 768, 768, ourDC, 0, 0, SRCCOPY);
}
break;
Comment