Jump to content
Sign in to follow this  

GetPixelColor does not work!

Recommended Posts


Hey People,

i have a problem and searched long time without any result.

so i using the UDF GetPixelColor to capture a bmp into the memory, that works nice but, pixelgetcolor return always 000000, except the first retun, here i get a hex color value....

i dont understand this, a friend tested it, and he get all color values, do i tried somthing to update my gdi32.dll without success :)

I use Windows XP Home Edition SP2 ...

$hDll = DllOpen("gdi32.dll")
        $vDC = _PixelGetColor_CreateDC()
        $vRegion = _PixelGetColor_CaptureRegion($vDC,$iLeft,$iTop,$iRight,$iBottom)
        If $DebugMode Then logger("debug", "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
        If $DebugMode Then logger("debug", "read bitmap to array")  
    ; === read pixels ===
        If $DebugMode And $iShowFillArray Then logger("debug", "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
        For $i = 0 to $iHeight-1 Step 1
            For $j = 0 to $iWidth-1 Step 1
                $sColor = _PixelGetColor_GetPixel($vDC, $j, $i, $hDll)
                If $DebugMode And $iShowFillArray Then logger("debug", $i & "->" & $j & " color: " & $sColor)   
                If $sColor = "FFFFFF" Then
                    $Coords[$i][$j] = True
                    $Coords[$i][$j] = False

remember this script work on the other pc, not on mine...

i get these log entries:

3.03.2008 23:04:13 [debug] capture screen rectangle
23.03.2008 23:04:13 [debug] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23.03.2008 23:04:13 [debug] left=917
23.03.2008 23:04:13 [debug] top=39
23.03.2008 23:04:13 [debug] right=962
23.03.2008 23:04:13 [debug] bottom=47
23.03.2008 23:04:13 [debug] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23.03.2008 23:04:13 [debug] read bitmap to array
23.03.2008 23:04:13 [debug] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23.03.2008 23:04:13 [debug] 0->0 color: 080800
23.03.2008 23:04:13 [debug] 0->1 color: 000000
23.03.2008 23:04:13 [debug] 0->2 color: 000000
23.03.2008 23:04:13 [debug] 0->3 color: 000000
23.03.2008 23:04:13 [debug] 0->4 color: 000000
23.03.2008 23:04:13 [debug] 0->5 color: 000000
23.03.2008 23:04:13 [debug] 0->6 color: 000000
23.03.2008 23:04:13 [debug] 0->7 color: 000000
23.03.2008 23:04:13 [debug] 0->8 color: 000000
23.03.2008 23:04:13 [debug] 0->9 color: 000000
23.03.2008 23:04:13 [debug] 0->10 color: 000000

the first value is right... but the next, i dont undestarnd this shit :)( i need help

Share this post

Link to post
Share on other sites

now i installed windows xp professional and get the same values... i dont know why...

a new theorie is, that the gdi32.dll is installed by the graphic drivers. i dont know any else know somethin about that? iam usin Nvidia Gerforce 4600 ti i know this is older but is that the reason why i cant use getpixel from the gdi32.dll?? oks help

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.