timv wrote in vbdev

This code is in a For Loop that rips frames (or "cells") from a bitmap...


        Let hdcSprite(i) = CreateCompatibleDC(0)
        If hdcSprite(i) = 0 Then GoTo errHandler
       
        Let hbmSprite(i) = CreateCompatibleBitmap(hdcSprite(i), mFrameWidth, mFrameHeight)
        If hbmSprite(i) = 0 Then GoTo errHandler
       
        Let retVal = SelectObject(hdcSprite(i), hbmSprite(i))
        If retVal = 0 Then GoTo errHandler
       
        Let retVal = DeleteObject(retVal)
        If retVal = 0 Then GoTo errHandler
       
        Let xPos = (i Mod Columns) * mFrameWidth
        Let yPos = CLng(i / Columns) * mFrameHeight
       
        Let retVal = BitBlt(hdcSprite(i), 0, 0, mFrameWidth, mFrameHeight, hdc, xPos, yPos, SRCCOPY)
        If retVal = 0 Then GoTo errHandler
       

Problem is, when I Blit the image, the white parts of the image are white, and the rest is black.  I am sure that my SRCCOPY value is correct.  What is confusing me is that I can Blit the source image to a visible DC (like a form), and the frame/image comes out correct...but when I Blit it to the non-visible DC and then Blit that image to the screen, I get the described effect.  Can anyone see what I am doing wrong??