GetPixel Rückgabewert zu groß?



  • Ich erhalte als Rückgabewert von GetPixel: ffffffff;
    Aber es soll doch ein RGB Wert sein und dürfte damit nur 6 Stellen haben?
    Was mache ich falsch?

    COLORREF GetColorOfPixel(DWORD x, DWORD y, HWND hWnd)
    {
        HDC hDC = GetDC(hWnd);
        COLORREF cr = GetPixel(hDC,x,y);
        ReleaseDC(hWnd, hDC);
        return cr;
    }
    
    ...
    
    HWND hWnd = WindowFromPoint(point);
    farbe1 = GetColorOfPixel(220,150, hWnd);
    printf("\nHexadezimal: %x\n", farbe1);
    

    Im MSDN steht noch:
    An application should call GetDeviceCaps to determine whether a specified device supports this function.

    Was hat es damit auf sich? Verstehe nicht so ganz wie ich die Funktionen benuten soll.
    Dank vorab



  • MSDN schrieb:

    The return value is the RGB value of the pixel. If the pixel is outside of the current clipping region, the return value is CLR_INVALID.

    ( CLR_INVALID == 0xFFFFFFFF )


Anmelden zum Antworten