I need to get the colour of a pixel in the specified location. After some research this is what I have.
#include<windows.h>
#include<iostream>
int main()
{
HDC dc = GetDC(NULL);
COLORREF color = GetPixel(dc, 100, 100);
ReleaseDC(NULL, dc);
std::cout << GetRValue(color);
std::cout << GetGValue(color);
std::cout << GetBValue(color);
return 0;
}
I don't get any error but there are three weird characters displayed(which I cannot seem to copy and paste here). What can I do to get the pixel colour successfully?