c++getpixel

getpixel from externan application MFC


the color is #B38300 but it returns me #074092 I'm trying get pixel color of 3D Application.

::SetForegroundWindow(tempHWND);
Sleep(2000);
HDC hDC = ::GetDC(tempHWND);
COLORREF rgb = ::GetPixel(hDC,50,60);
int redValue = GetRValue(rgb);
int greenValue = GetGValue(rgb);
int blueValue = GetBValue(rgb);

How can I get exacly color?


Solution

  • HDC hDC = CreateDC(L"DISPLAY",0,0,0);
    

    I'm using that code and it works!