I am loading 2 images (sprite and mask) into DC that I have created using the CreateCompatibleDC api, and then I blit them into the screen. My question is: How do I create another dc so I can blit the new transparent image (result of mask + sprite) into it, and not into the form.

The code I am using is the following, but it doesn't work, even though I don't get any errors. But is works OK when I blit them into the screen.

VB Code:
  1. Private Sub Form_Activate()
  2.  
  3. 'Create DC
  4. MaskDC = CreateCompatibleDC(Me.hdc)
  5. SpriteDC = CreateCompatibleDC(Me.hdc)
  6. FinalImageDC = CreateCompatibleDC(Me.hdc)
  7.  
  8. 'Load images
  9. MaskIM = LoadImage(0, "C:\WINDOWS\Desktop\Henrique\Shooter\Images\target_hit_mask.bmp", 0, 0, 0, &H10)
  10. SpriteIM = LoadImage(0, "C:\WINDOWS\Desktop\Henrique\Shooter\Images\target_hit_sprite.bmp", 0, 0, 0, &H10)
  11.  
  12. 'Link DC with image
  13. SelectObject MaskDC, MaskIM
  14. SelectObject SpriteDC, SpriteIM
  15.  
  16. 'Go through each separate part of the images
  17.     Do
  18.        
  19.         DoEvents
  20.         Me.Cls
  21.        
  22.         'This is what does not work, the FinalImageDC
  23.         BitBlt FinalImageDC, 10, 10, 30, 74, MaskDC, x, 0, vbSrcAnd
  24.         BitBlt FinalImageDC, 10, 10, 30, 74, SpriteDC, x, 0, vbSrcPaint
  25.        
  26.         x = x + 31
  27.        
  28.         If x >= 740 Then
  29.             x = 0
  30.         End If
  31.                
  32.     Loop Until GameOver = True
  33. End Sub

Is this the right way of doing this, or is there another API call for this?

Thanks