[HELP] Scan for a certain pixel

Posts 16–30 of 38 · Page 2 of 3
Damn, it's not working for me either. GetPixel keeps returning -1 (0xFFFFFFFF). Not sure why, I can't find a good explanation anywhere..

I'll keep looking into this.
thanks, i will try to figure it out also, it's really pissing me off.
yeah, i still can't figure it out, any help is appreciated
I checked the return value of GetPixel and it returns CLR_INVALID.

MSDN: "If the pixel is outside of the current clipping region, the return value is CLR_INVALID."

I looked up as much as I can on the clipping region but can't find a solution. Sorry mang.
Thanks a bunch
rofl silly noobs

Code:
HDC hdc = GetDC(0);
for(int x=0;x<GetSystemMetrics(SM_SCREENX);x++)
{
    for(int y=0;y<GetSystemMetrics(SM_SCREENY);y++)
    {
        if(GetPixel(hdc, x, y) == COLORREF(255, 0, 0)) MessageBox(0, L"TROLL", L"TROLL", MK_OK);
    }
}
untested as i'm lazy.
thanks, i will check this out.
ok, so here's my code but it won't work, it won't detect the color and set the cursor to the position.
here's my code:

Code:
 #include <iostream>
#include <windows.h>

using namespace std;
int main()
{
int x;
int y;
HWND hwnd = GetDesktopWindow();
HDC hdc = GetDC(hwnd);
COLORREF rgb;
COLORREF red;
COLORREF green;
COLORREF blue;
while(true)
{
	for(x = 0; x<GetSystemMetrics(SM_CXSCREEN); x++)
	{
		for(y = 0; y<GetSystemMetrics(SM_CYSCREEN); y++)
		{
			rgb = GetPixel(hdc, x, y);
			red = GetRValue(rgb);
			green = GetGValue(rgb);
			blue = GetBValue(rgb);
			if(red==0 && green==127 && blue==252){SetCursorPos(x,y);}
			if(GetAsyncKeyState(VK_SHIFT)&1){return 0;}
		
	}
}
}
}
Quote Originally Posted by 258456 View Post
ok, so here's my code but it won't work, it won't detect the color and set the cursor to the position.
here's my code:

Code:
 #include <iostream>
#include <windows.h>

using namespace std;
int main()
{
int x;
int y;
HWND hwnd = GetDesktopWindow();
HDC hdc = GetDC(hwnd);
COLORREF rgb;
COLORREF red;
COLORREF green;
COLORREF blue;
while(true)
{
	for(x = 0; x<GetSystemMetrics(SM_CXSCREEN); x++)
	{
		for(y = 0; y<GetSystemMetrics(SM_CYSCREEN); y++)
		{
			rgb = GetPixel(hdc, x, y);
			red = GetRValue(rgb);
			green = GetGValue(rgb);
			blue = GetBValue(rgb);
			if(red==0 && green==127 && blue==252){SetCursorPos(x,y);}
			if(GetAsyncKeyState(VK_SHIFT)&1){return 0;}
		
	}
}
}
}
So why you post it? oO
Quote Originally Posted by Gab View Post


So why you post it? oO
Maybe so he can get help to why it's not working?
ur making it sound like this is annoying you. lol. (i know it's annoying, just in case you didn't get the sarcasm).

EDIT:___________________________________________

WOW, awesome link, it was so obvious, i feel so stupid, i don't need to use GetSystem Metrics after all. Thanks HD, and you too Void.
Quote Originally Posted by 258456 View Post
ur making it sound like this is annoying you. lol. (i know it's annoying, just in case you didn't get the sarcasm).
Lol nawww d/w
It's all k =P
ok, so i have managed to make an aimbot for a game on armor games by making the program retrieve the rbg of the Cursor Position, my goal though, was making the program scan the screen for the pixel . i have tried this method:

Code:
 for(int x = 0; x < 1200; x++){
           for(int y = 0; y< 1200; y++){
i also used this method:
Code:
 int cx,cy;
cx = GetSystemMetrics(SM_CXSCREEN);
cy = GetSystemMetrics(SM_CYSCREEN);
          for(int x = 0; x<cx; x++){
          for(int y = 0; y<cy; y++){

but the problem in both methods is that it won't scan the whole screen for some reason. If anybody has a solution i would appreciate it.
cout<<"Debug!!11 LOL! X = "<<cx<<" and bitchfag Y="<<cy;
Posts 16–30 of 38 · Page 2 of 3

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us