BitBlt trouble.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DumRat
    New Member
    • Mar 2007
    • 93

    #1

    BitBlt trouble.

    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.

    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;
  • romanize
    New Member
    • Jul 2008
    • 5

    #2
    a late response it seems. have you found out where the problem was?
    i remember having similar problems - some years ago though. did you try to createcompatibl edc from the same GetDC?
    r.

    Comment

    Working...