I've been creating a little program to read in a file (Using CreateDC to create the device handle) and then send it to GetPixel to be read into a RGB value.
There are two problems so far. I have created an if statement to check if CreateDC succeeded (Checks if it is NULL), but it's always failing. The code is:
Code:
if((hdc=CreateDC(Image.png,NULL,NULL,NULL))==NULL) {
cout<<"ERROR: Failed to load image";
}
The image IS in the same directory as the program, so that isn't the problem.
I also don't understand exactly how GetPixel works. I know it returns f a COLORREF value, which I have passed to GetRValue, GetGValue, and GetBValue and put them in to separate variables. The problem is, I don't know how to combine those values to make a normal color code to perhaps compare against an enum.
MSDN has been little help, as they are not very descriptive and there are no examples I can find. I've been Googling non-stop for 2 days with no avail. If anyone could shine some light on the situation, I'd be eternally greatful.