__declspec(dllexport) XYCOORD pxscan(HWND hwnd, DWORD color, RECT region, unsigned short skip, unsigned tolerance)
{
RECT rect;
GetWindowRect(hwnd, &rect);
HDC hDC = GetDC(hwnd);
for(int i = region.left + rect.left; i <= (region.right + rect.left); i += skip)
{
for(int n = region.top + rect.top; n <= region.top - rect.bottom; n += skip)
{
DWORD c = GetPixel(hDC, i, n);
if(abs(c - color) <= tolerance)
{
XYCOORD coord;
coord.x = i;
coord.y = n;
return coord;
}
}
}
XYCOORD failed;
failed.x = -1;
failed.y = -1;
return failed;
}
XYCOORD auto_setup = pxscan(client, 0x202020, a, 1, 5);
