so far i have this code..
#include "stdafx.h"
#include <iostream>
#include <windows.h>
#include <string>
using namespace std;
int main ()
{
const int r1 = 175;
const int g1 = 163;
const int b1 = 134;
HWND hwnd = FindWindow(NULL,"Test - Microsoft Visual Studio");
SetForegroundWindow(hwnd);
HDC hdc = GetDC(hwnd);
POINT lame;
lame.x = 0;
lame.y = 0;
int x = lame.x;
int y = lame.y;
for (int i = 0; i < 1280; i++)
{
x = i;
y = 0;
COLORREF col = GetPixel(hdc,lame.x,lame.y);
int red1 = GetRValue(col);
int green1 = GetGValue(col);
int blue1 = GetBValue(col);
if (x == 1280)
{
y = lame.y++;
i = 0;
}
if (y == 801)
{
system("pause");
}
if (red1 == r1 && green1 == g1 && blue1 == b1)
{
cout << "Pixel found at: \t" << "X: "<< x << "\t\t" << "Y: " << y << "\n";
system("pause");
}
}
system("pause");
return 0;
}
i use it for scanning for a certain pixel on the screen but it doesn't seem to be working... no compiler or runtime errors but it just skips straight to press any key to continue...
i also can't find any resources to teach me some bitmap way..
if someone would care to explain how to capture screen to bmp and then analyze it for pixels..
or just tell me where i've gone wrong in my code.