c++getpixel

(C++) How to use GetPixel() of x y on screen


Could someone make some code that gets the pixel of an x y coord on screen and explain how the code works. I have read other examples but I dont know what all the functions and code do. Thanks.


Solution

  • HDC hdcScreen = GetDC(0);
    COLORREF crPixel = GetPixel(hdcScreen, 10, 10);
    ReleaseDC(0, hdcScreen);
    

    Will store the displayed pixel at coordinates 10,10 into crPixel.

    Is this what you were asking for?