level 8
Sail丶Man
楼主
呵呵, 自从上回写出了找色 这个程序 真的发现它是越来越强大了。
——————————————————————
大家先玩玩这个小游戏。手速要快的补血小游戏。
http://zy.anjian.com/lab/content_02.html
——————————————————————
以下是我为这个小游戏写的一个外挂。Esc可退出程序。
# include <graphics.h>
# include <stdio.h>
POINT ZhaoSe(COLORREF c);//找色要配合下面那个函数
void CaptureDesktop(IMAGE *);//找色工具配合这个一起用 构成 找色工具
void Quit(void);//退出程序
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)//主函数
{
POINT point;
COLORREF c;
COLORREF c1;
COLORREF c2;
COLORREF c3;
COLORREF c4;
COLORREF c5;
HDC hdc = GetDC(NULL);//获取桌面hdc
while (true)
{
point = ZhaoSe(0x81511f);
c = GetPixel(hdc, point.x - 312, point.y - 335);//血低于这个点时 按q
c1 = GetPixel(hdc, point.x - 312, point.y - 291);
c2 = GetPixel(hdc, point.x - 353, point.y - 108);
c3 = GetPixel(hdc, point.x - 265, point.y - 108);
c4 = GetPixel(hdc, point.x - 100, point.y - 126);
c5 = GetPixel(hdc, point.x - 15, point.y - 120);//以上同理
if (0xaeaeae == c)//空血条的背景颜色 ,血低于这个点时 按q 以下同理。
{
keybd_event(81,0,0,0);
keybd_event(81,0,KEYEVENTF_KEYUP,0);
}
if (0xaeaeae == c1)
{
keybd_event(87,0,0,0);
keybd_event(87,0,KEYEVENTF_KEYUP,0);
}
if (0xffffff == c2)
{
keybd_event(65,0,0,0);
keybd_event(65,0,KEYEVENTF_KEYUP,0);
}
if (0xffffff == c3)
{
keybd_event(83,0,0,0);
keybd_event(83,0,KEYEVENTF_KEYUP,0);
}
if (0xe6e6e6 == c4)
{
keybd_event(68,0,0,0);
keybd_event(68,0,KEYEVENTF_KEYUP,0);
}
if (0xe6e6e6 == c5)
{
keybd_event(70,0,0,0);
keybd_event(70,0,KEYEVENTF_KEYUP,0);
}Quit();
/*while(GetAsyncKeyState(VK_ESCAPE)){Sleep(20);exit(0);}*/}
return 0;}
void CaptureDesktop(IMAGE *pimg)
{
int w = GetSystemMetrics(SM_CXSCREEN) ;
int h = GetSystemMetrics(SM_CYSCREEN) ;
Resize(pimg, w, h);
HDC aa = GetDC(NULL);
HDC dstDC = GetImageHDC(pimg);
BitBlt(dstDC, 0, 0, w, h, aa, 0, 0, SRCCOPY);}
POINT ZhaoSe(COLORREF c)
{POINT point;
int w = GetSystemMetrics(SM_CXSCREEN) ;
int h = GetSystemMetrics(SM_CYSCREEN) ;
IMAGE img;
CaptureDesktop(&img);
saveimage(_T("f:\\testq1.bmp"), &img); //这部不是多余的,不要会出莫名其妙的问题。
loadimage(&img, "f:\\testq1.bmp");//这部不是多余的,不要会出莫名其妙的问题。
DWORD* p = GetImageBuffer(&img);
for(int i = 0; i < w; i++)
{
for(int j = 0;
j < h; j++)if (p[j * w + i] == BGR(c) )
{
point.x = i;
point.y = j;
break;
}
if (point.x>=0 && point.y>=0)
break;
}
DeleteFile("f:\\testq1.bmp");
return point;
}
void Quit(void)
{
if(GetAsyncKeyState(VK_ESCAPE))
{
if(MessageBox(NULL, "你确定要退出吗?","提示", MB_YESNO) == IDYES)
exit(0);
}
return ;}
————————————————————————————-
补血 自动 按键非常好写,但最大的问题就是 每个人打开的窗口位置不同,
依然要找准每罐血要到底时就非常难了,找色就很好地解决了这个问题,
因为 它用的不是绝对位置,而是相对位置,例如这个游戏中我找的参考点就是 按键精灵这几个字。 我先用找色工具找到 “按”字 的左上角坐标 再相对于这个坐标来决定某个(血快要完点)点位置比如point.x - 312这样无论你窗口怎么动 都可以找准这个点了。
我也不知道你们听懂没,程序很简单可以自己看懂。
呵呵,我觉得EasyX完全可以考虑把这个找色工具列入教程了~~。
说真心话这个工具用处真的太大了。
I
2013年09月20日 10点09分
1
——————————————————————
大家先玩玩这个小游戏。手速要快的补血小游戏。
http://zy.anjian.com/lab/content_02.html
——————————————————————
以下是我为这个小游戏写的一个外挂。Esc可退出程序。
# include <graphics.h>
# include <stdio.h>
POINT ZhaoSe(COLORREF c);//找色要配合下面那个函数
void CaptureDesktop(IMAGE *);//找色工具配合这个一起用 构成 找色工具
void Quit(void);//退出程序
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)//主函数
{
POINT point;
COLORREF c;
COLORREF c1;
COLORREF c2;
COLORREF c3;
COLORREF c4;
COLORREF c5;
HDC hdc = GetDC(NULL);//获取桌面hdc
while (true)
{
point = ZhaoSe(0x81511f);
c = GetPixel(hdc, point.x - 312, point.y - 335);//血低于这个点时 按q
c1 = GetPixel(hdc, point.x - 312, point.y - 291);
c2 = GetPixel(hdc, point.x - 353, point.y - 108);
c3 = GetPixel(hdc, point.x - 265, point.y - 108);
c4 = GetPixel(hdc, point.x - 100, point.y - 126);
c5 = GetPixel(hdc, point.x - 15, point.y - 120);//以上同理
if (0xaeaeae == c)//空血条的背景颜色 ,血低于这个点时 按q 以下同理。
{
keybd_event(81,0,0,0);
keybd_event(81,0,KEYEVENTF_KEYUP,0);
}
if (0xaeaeae == c1)
{
keybd_event(87,0,0,0);
keybd_event(87,0,KEYEVENTF_KEYUP,0);
}
if (0xffffff == c2)
{
keybd_event(65,0,0,0);
keybd_event(65,0,KEYEVENTF_KEYUP,0);
}
if (0xffffff == c3)
{
keybd_event(83,0,0,0);
keybd_event(83,0,KEYEVENTF_KEYUP,0);
}
if (0xe6e6e6 == c4)
{
keybd_event(68,0,0,0);
keybd_event(68,0,KEYEVENTF_KEYUP,0);
}
if (0xe6e6e6 == c5)
{
keybd_event(70,0,0,0);
keybd_event(70,0,KEYEVENTF_KEYUP,0);
}Quit();
/*while(GetAsyncKeyState(VK_ESCAPE)){Sleep(20);exit(0);}*/}
return 0;}
void CaptureDesktop(IMAGE *pimg)
{
int w = GetSystemMetrics(SM_CXSCREEN) ;
int h = GetSystemMetrics(SM_CYSCREEN) ;
Resize(pimg, w, h);
HDC aa = GetDC(NULL);
HDC dstDC = GetImageHDC(pimg);
BitBlt(dstDC, 0, 0, w, h, aa, 0, 0, SRCCOPY);}
POINT ZhaoSe(COLORREF c)
{POINT point;
int w = GetSystemMetrics(SM_CXSCREEN) ;
int h = GetSystemMetrics(SM_CYSCREEN) ;
IMAGE img;
CaptureDesktop(&img);
saveimage(_T("f:\\testq1.bmp"), &img); //这部不是多余的,不要会出莫名其妙的问题。
loadimage(&img, "f:\\testq1.bmp");//这部不是多余的,不要会出莫名其妙的问题。
DWORD* p = GetImageBuffer(&img);
for(int i = 0; i < w; i++)
{
for(int j = 0;
j < h; j++)if (p[j * w + i] == BGR(c) )
{
point.x = i;
point.y = j;
break;
}
if (point.x>=0 && point.y>=0)
break;
}
DeleteFile("f:\\testq1.bmp");
return point;
}
void Quit(void)
{
if(GetAsyncKeyState(VK_ESCAPE))
{
if(MessageBox(NULL, "你确定要退出吗?","提示", MB_YESNO) == IDYES)
exit(0);
}
return ;}
————————————————————————————-
补血 自动 按键非常好写,但最大的问题就是 每个人打开的窗口位置不同,
依然要找准每罐血要到底时就非常难了,找色就很好地解决了这个问题,
因为 它用的不是绝对位置,而是相对位置,例如这个游戏中我找的参考点就是 按键精灵这几个字。 我先用找色工具找到 “按”字 的左上角坐标 再相对于这个坐标来决定某个(血快要完点)点位置比如point.x - 312这样无论你窗口怎么动 都可以找准这个点了。
我也不知道你们听懂没,程序很简单可以自己看懂。
呵呵,我觉得EasyX完全可以考虑把这个找色工具列入教程了~~。
说真心话这个工具用处真的太大了。
I