k i have done a little experiment and come up with this but it dosnt work. please take a look at it.
Code:
#include "stdafx.h"
int main()
{
HDC hdcScrn; // Handle on accessing screen parameters.
HDC hdc;
hdcScrn = CreateDC( "DISPLAY", 0, 0, 0 );
hdc = CreateDC( "DISPLAY", 0, 0, 0 );
COLORREF Col; // a Color type
COLORREF Find;
POINT Pos1, Pos2; // cursor positions
for (;;)
{
int x;
int y;
x++;
y++;
Find = GetPixel( hdc, x, y ); // sets the color variable to the cursor position.
if (Find == 1976248)
{
cout<<"Found it";
Sleep(5000);
}
}
while ( true )
{
GetCursorPos( &Pos1 ); // get cursor position
if ( (Pos1.x != Pos2.x) ||
(Pos1.y != Pos2.y) ) // sees if the cursor has moved
{
GetCursorPos( &Pos2 );
Col = GetPixel( hdcScrn, Pos2.x, Pos2.y ); // sets the color variable to the cursor position.
cout<<" \rThe color of Position ("<< Pos2.x << ',' << Pos2.y << "), is " << Col << "\t\t";
}
}
DeleteDC( hdcScrn ); // deletes the handle
return 0;
}