Je cherche à récupérer les coordonnées et la couleur du pixel pointé par la souris, dans une simple console dos, sous Dev C++, mais j'ai les 2 messages d'erreur :
cannot convert `HWND__*' to `HDC__*' in assignment
cannot convert `HDC__*' to `HWND__*' for argument `1' to `HDC__*
int main (int argc, char *argv[])
{
// Déclarations locales
HDC hand;
POINT pt;
COLORREF Pix;
int R,G,B;
int y,x;
// Actions
do{
GetCursorPos(&pt);
hand = WindowFromPoint(pt); //<--------------1ere erreur
x = pt.x;
y = pt.y;
Pix = GetPixel(GetDC(hand), x, y);//<-----------2e erreur
R = GetRValue(Pix);//->valeur du rouge (0-255)
G = GetGValue(Pix);//->valeur du vert (0-255)
B = GetBValue(Pix);//->valeur du bleu (0-255)
cout << "x="<<x<<endl;
cout << "y="<<y<<endl;
cout << "R="<<R<<endl;
cout << "G="<<G<<endl;
cout << "B="<<B<<endl;
clrscr();
}
while (x>1);
// retour au sytème d'exploitattion
cout << endl;
system("pause");
return (0);
}