Code:
#include "stdafx.h"
#include <windows.h>
#include <stdio.h>
#include <iostream>
#include <time.h>
#include <fstream>
using namespace std;
int main() {
POINT p;
GetCursorPos(&p);
HDC hdc = GetDC(HWND_DESKTOP); //het scherm
COLORREF CR1; //3 kleuren
int y = 0;
int get = 0;
int hoeveel = 0;
int hx = 0;
int hy = 0;
int hx2 = 0;
int hy2 = 0;
char FileName[20];
//cout << "\nFilename: ";
//cin >> FileName;
cout << "\n";
cout << "\nFilename: ";
cin >> FileName;
cout << "\n";
bool aimer = false;
while(1) {
if ((GetAsyncKeyState(VK_F10)&1) ) {
aimer = true;
GetCursorPos(&p);
}
if ((GetAsyncKeyState(VK_F9)&1)) {
GetCursorPos(&p);
SetCursorPos(p.x-7,p.y-7);
Sleep(1000);
SetCursorPos(p.x+7,p.y+7);
Sleep(1000);
SetCursorPos(p.x,p.y);
aimer = false;
}
if ( aimer == true ) {
time_t start;
start = time(NULL);
int hoeveel = 0;
int hx = 0;
int hy = 0;
//cout << "start";
for(int y=-7;y<7;y++) {
for(int x=-7;x<7;x++) {
CR1 = GetPixel(hdc,p.x+x,p.y+y);
int R = GetRValue(CR1);
int G = GetGValue(CR1);
int B = GetBValue(CR1);
ofstream Students(FileName, ios::app);
Students << " if( fcollerfind(" << R << "," << G << "," << B << ",CR1,3,2,welke,y,x) ) { \n hx = hx + p.x+x; \n hy = hy + p.y+y; \n hoeveel++; \n } \n welke++; \n\n";
cout << R << " " << G << " " << B << " | ";
}
}
time_t end;
end = time(NULL);
cout << "\n Sec: " << end - start ;
}
aimer = false;
Sleep(100);
}
system("pause");
return 0;
}
Collor searth by me