---
title: "QQ找茬外挂 开源"
author: "feihen"
date: "2011-01-12T11:31:58Z"
tags: ["MFC", "QQ", "Windows", "数据结构", "游戏"]
categories: ["编程语言"]
slug: "qq"
draft: false
lastmod: "2011-01-12T11:31:58Z"
id: 869061
url: "https://feihen.iteye.com/blog/869061"
---

[http://hi.baidu.com/blue236146\_/blog/item/1ca20f93d277729fa877a449.html](http://hi.baidu.com/blue236146_/blog/item/1ca20f93d277729fa877a449.html)

 

一，设计思路.

1，在屏幕上截取两幅图片，保存为BMP类型.

2，读取两幅位图的数据区，对比RGB值，不同将该像素区域设为255,0,0.  (此处不是红色，而是蓝色，具体原因参看我整理的BMP位图结构)

3，新建空位图，将新的数据区拷贝到空位图中.此时该位图已经把两幅图片的不同之处都用蓝色覆盖了.

4，用StretchDIBits将新位图显示在我们的对话框程序上.

5，处理对话框程序上的鼠标点击消息.

PS: 我希望学习交流的朋友可以按照流程自己去写代码，所以在此我传的为截图，望谅解.

二，实际开发. （空间不能添加附件...  汗！）

Remark: 如对BMP结构不了解，先看看我之前写的文章 BMP位图结构.

创建MFC AppWizard(exe) 工程名 Plugin

![](http://hiphotos.baidu.com/blue236146_/pic/item/13a37ff011b5bb1e342acc43.jpg)

选择一个基于对话框的应用程序  
![](http://hiphotos.baidu.com/blue236146_/pic/item/7c908d96687fff05d0135e55.jpg)

设计对话框结构如下图

控件ID：

IDC\_BTN\_SNAPSHOT

IDC\_BTN\_ABOUT

 IDC\_BTN\_MIN  

  IDC\_BTN\_EXIT

中间最大的区域为 IDC\_BTN\_BMP

![](http://hiphotos.baidu.com/blue236146_/pic/item/74a3ffa25ce026c546106482.jpg)

在CPluginDlg类中创建 析构函数和公有数据，构造函数中自己对值初始化下，我不贴代码了.

![](http://hiphotos.baidu.com/blue236146_/pic/item/940e8eec49031e78acafd59b.jpg)

 

析构函数： Remark：三幅位图在后面会产生

![](http://hiphotos.baidu.com/blue236146_/pic/item/024c8b18c404a8b4ae513363.jpg)

在BOOL CPluginDlg::OnInitDialog()中：

![](http://hiphotos.baidu.com/blue236146_/pic/item/709af3031ddb6fc9e850cd79.jpg)

给功能区四个控件添加响应函数：需包含bitmaps.h

![](http://hiphotos.baidu.com/blue236146_/pic/item/066f39dac82f54a738012f50.jpg)

![](http://hiphotos.baidu.com/blue236146_/pic/item/ad59143edbde0ca03c6d975b.jpg)

![](http://hiphotos.baidu.com/blue236146_/pic/item/16baaec77f1616e78326ac2d.jpg)

![](http://hiphotos.baidu.com/blue236146_/pic/item/f14473d26276ec769a502729.jpg)

![](http://hiphotos.baidu.com/blue236146_/pic/item/da9d220a406325813ac76337.jpg)

![](http://hiphotos.baidu.com/blue236146_/pic/item/de2adb52bede5a6a43a75b06.jpg)

 

![](http://hiphotos.baidu.com/blue236146_/pic/item/e3804cf49820cd6c730eec03.jpg)

![](http://hiphotos.baidu.com/blue236146_/pic/item/2237e1c1e06187550ff47710.jpg)

此时四个控件响应代码添加完毕了，我们还需要将位图C显示在我们的对话框上

添加WINDOWS消息处理：

![](http://hiphotos.baidu.com/blue236146_/pic/item/02258c14f8b53247c83d6de4.jpg)

添加 鼠标左键单击消息的处理：

![](http://hiphotos.baidu.com/blue236146_/pic/item/709af3031d656fc9e850cdef.jpg)

添加 虚函数截取消息

![](http://hiphotos.baidu.com/blue236146_/pic/item/57bcfb0a7ad0a36a6a60fbcc.jpg)

OK了！  此时编译链接有错误的话改下，运行后：

![](http://hiphotos.baidu.com/blue236146_/pic/item/02258c14f8f53247c83d6da4.jpg)

之后去QQGAME试验下！

好嘛！ 我找了两个蓝钻！ 我们只虐蓝钻...

![](http://hiphotos.baidu.com/blue236146_/pic/item/0ec7464cb926a278aec3aba8.jpg)

点击截图对比

![](http://hiphotos.baidu.com/blue236146_/pic/item/e2b3fc115c169680c2fd78bb.jpg)

之后手动点下蓝色方块区域

![](http://hiphotos.baidu.com/blue236146_/pic/item/ad59143edb660ca03c6d9783.jpg)

![](http://hiphotos.baidu.com/blue236146_/pic/item/75b54c270218c165d4074291.jpg)

好嘛. 让我们尽情去虐蓝钻吧.

PS：为维护游戏公平秩序，我希望各位写完代码之后不要发布此程序. 仅供大家学习交流.

需要源文件的朋友可以PM我.