Getting pixel colors with DCs
Hello guys,
that's my code:
Code:
dim DCSprite as long
dim BMPSprite as long
Public Function SetPicture(hDC As Long, lWidth As Long, lHeight As Long) As Boolean
DCSprite = CreateCompatibleDC(0)
BMPSprite = CreateCompatibleBitmap(hDC, lWidth, lHeight)
If (DCSprite < 1) Or (BMPSprite < 1) Then
SetPicture = False
Exit Function
End If
SelectObject DCSprite, BMPSprite
BitBlt DCSprite, 0, 0, lWidth, lHeight, hDC, 0, 0, vbSrcCopy
SetPicture = True
End Function
All works fine, if I bitblt to form1 I can get my image, but if I try to get the color of pixels with GetPixel it returns always -1...
Any suggestions??!?
Thx,
Xmas