Transparent Form and GetPixel/BitBlt

NeuralJack

Centurion
Joined
Jul 28, 2005
Messages
138
Hello, I am having trouble reading pixel colors with GetPixel() user32 api from a .NET program which has a form that is in Transparent mode. It's easy to reproduce this on any program you might want to make.

I was wondering if anyone if anyone knows why this might be happening and if there is a way around it. Even though there are plenty of pictures, text, etc on the "transparent" form GetPixel can not read any of the colors from those objects.

Oh very important is that BitBlt also does not work on "Transparent" forms. So how can one take screenshots of a program?

Thanks

Code:
  Public Declare Function GetPixel Lib "gdi32" Alias "GetPixel" (ByVal hdc As IntPtr, ByVal x As Integer, ByVal y As Integer) As Integer

Code:
  Public Declare Function BitBlt Lib "gdi32.dll" (ByVal hdc As IntPtr, ByVal nXDest As Integer, ByVal nYDest As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hdcSrc As IntPtr, ByVal nXSrc As Integer, ByVal nYSrc As Integer, ByVal dwRop As TernaryRasterOperations) As Boolean

    Public Enum TernaryRasterOperations
        SRCCOPY = &HCC0020 ' dest = source
        SRCPAINT = &HEE0086 ' dest = source OR dest
        SRCAND = &H8800C6 ' dest = source AND dest
        SRCINVERT = &H660046 ' dest = source XOR dest
        SRCERASE = &H440328 ' dest = source AND (NOT dest )
        NOTSRCCOPY = &H330008 ' dest = (NOT source)
        NOTSRCERASE = &H1100A6 ' dest = (NOT src) AND (NOT dest)
        MERGECOPY = &HC000CA ' dest = (source AND pattern)
        MERGEPAINT = &HBB0226 ' dest = (NOT source) OR dest
        PATCOPY = &HF00021 ' dest = pattern
        PATPAINT = &HFB0A09 ' dest = DPSnoo
        PATINVERT = &H5A0049 ' dest = pattern XOR dest
        DSTINVERT = &H550009 ' dest = (NOT dest)
        BLACKNESS = &H42 ' dest = BLACK
        WHITENESS = &HFF0062 ' dest = WHITE
    End Enum
 
Back
Top