I'm trying to make a program that will detect the pixel color in the center of the screen. This is what I have:
1 2 3 4 5 6 7 8 9 10 11 12 13
#include <iostream>
#include <windows.h>
usingnamespace std;
COLORREF centerColor;
POINT cent;
int main()
{
HDC hdc_ = GetDC(GetDesktopWindow()) ; //I'm not sure if this is right or what exactly it does.
cent.x = 640;
cent.y = 512;
centerColor = GetPixel(hdc_, cent.x, cent.y);
}
Codeblocks gives me this error when I try to compile:
undefined reference to `_GetPixel@12'
I think the problem might be that I don't understand what to put in the "hdc_" variable.
I used the console application template with c++.
When I made the project the default compiler was set to "GNU GCC Compiler".
I tried compiling it with it set to Microsoft Visual C++ 2005/2008, but I got the same error (maybe I only set the default compiler to a different one, and not the compiler it uses on this project?).