Thank you for your Reply but I have figured it out I was havening a link error "undefined reference to getpixel@12" and I fixed it by going to project > Project options > load object file and loading "libgdi32.a".
Here is my code for any one els trying to get this stuff to work took me for ever lol.
Code:
#include <iostream>
#include <stdlib.h>
#include <windows.h>
int main()
{
int x,y;
cout << "Enter coordanets: ";
cin >> x;
cin >> y;
HDC hdc = GetDC(NULL);
DWORD color = GetPixel(hdc, x, y);
unsigned int r = GetRValue(color);
unsigned int g = GetGValue(color);
unsigned int b = GetBValue(color);
cout << "red: " << r << endl;
cout << "green: " << g << endl;
cout << "blue: " << b << endl;
cin.get();
cin.ignore();
return 0;
}
I do have a new task if any of you would like to help me. I’m working on making the mouse move to a color pixel bye using this code if you could help with that it would be grate thanks.
Also im stuck with this one see if any of you guys can help
Code:
#include <iostream>
#include <windows.h>
#include <stdlib.h>
using namespace std;
int main(int x, int y)
{
HANDLE mouseup = mouse_event(MOUSEEVENTF_LEFTUP, x, y, 0, 0);
WaitForSingleObject(mouseup, INFINITE);
cout << "should never appeared";
}
the goal im trying to reach with this is to wait untill the left buttin on the mouse lifts up.