En fait ce que je cherche ce sont des caracteres rouges. Je vais mettre mon code ce sera plus simple... mais il y a une erreur que je ne trouve pas lol ^^ : la couleur retournée est toujours 255,255,255... :
#include <windows.h> #include <conio.h> #include <stdio.h> #include <time.h>
int main (void) { HWND hwnd = GetDesktopWindow(); HDC hdc; hdc = GetDC(hwnd); long redValue, greenValue, blueValue; COLORREF color; POINT p; GetCursorPos(&p);
int PixelX=p.x-150; int PixelY=p.y-150; float test=0; while (PixelY<p.y+150) { PixelX=p.x-150; while (PixelX<p.x+150) { color = GetPixel(hdc, PixelX, PixelY); redValue = GetRValue(color); greenValue = GetGValue(color); blueValue = GetBValue(color); printf("%i %i %i\n",redValue,greenValue,blueValue);
if (redValue>250&&greenValue<30&&blueValue<30) { //printf("Pixel rouge à : x : %i et y : %i \n Valeur : R=%i G=%i B=%i\n",PixelX,PixelY,redValue,greenValue,blueValue); SetCursorPos(PixelX,PixelY); mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); Sleep(5000); } PixelX=PixelX+5; } if (PixelY>p.y+130) { GetCursorPos(&p); PixelY=p.y-150; } PixelY=PixelY+5; getch(); } system("PAUSE"); }
|