QQ2008自动聊天精灵delphi源码
QQ2008自动聊天精灵delphi源码
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons, ExtCtrls,Registry, ExtDlgs, bsSkinShellCtrls, BusinessSkinForm, bsSkinBoxCtrls, bsSkinCtrls;
type TTform1 = class(TForm) GroupBox1: TGroupBox; Bevel1: TBevel; Label2: TLabel; Bevel2: TBevel; Bevel3: TBevel; Bevel4: TBevel; FindBtn: TSpeedButton; Image1: TImage; SendBtn: TSpeedButton; LoadBtn: TSpeedButton; loaddialog1: TOpenDialog; ListBox1: TListBox; bsBusinessSkinForm1: TbsBusinessSkinForm; bsSkinOpenDialog1: TbsSkinOpenDialog; AoutBtn: TSpeedButton; procedure FormCreate(Sender: TObject); procedure FindBtnClick(Sender: TObject); procedure LoadBtnClick(Sender: TObject); procedure SendBtnClick(Sender: TObject); procedure AoutBtnClick(Sender: TObject);
private { Private declarations } public { Public declarations } end;
var Tform1: TTform1;
implementation {$R *.dfm} //定义一组全程变量 const WinCaption07:string='聊天中'; WinCaption08:string='交谈中'; var x:integer; TextBoxNum:shortint; //QQ输入框是第几个对话框 SendButtonNum:shortint; //发送按钮是第几个按钮 QQInputBoxHandle,SendButtonHandle:HWND;//发送按钮和输入框句柄 StopSend:boolean; //=====================延时时程序=================== procedure Delay(msecs:integer); var FirstTickCount:longint; begin FirstTickCount:=GetTickCount; repeat if STopSend then exit ; Application.ProcessMessages; until ((GetTickCount-FirstTickCount) >= Longint(msecs)); end; //=====================得到窗口内容=================== function GetWindowStr(Wnd: HWND): String; var Len: Integer; begin Len := SendMessage(Wnd, WM_GETTEXTLENGTH, 0, 0); SetLength(Result, Len + 1); SendMessage(Wnd, WM_GETTEXT, Length(Result), Longint(@Result[1])); end; //=====================得到所属类=================== function GetWindowClass(Wnd: HWND): String; begin SetLength(Result, 65); GetClassName(Wnd, @Result[1], 65); end;
//=====================查找子控件=================== function EnumChildProc(Wnd: HWND; lParam: LPARAM): Boolean; stdcall; var S, C: String; begin S := GetWindowStr(Wnd); C := GetWindowClass(Wnd); X:=X+1;
if Pos('RichEdit', C) =1 then begin TextBoxNum:=TextBoxNum+1; if TextBoxNum =3 then QQInputBoxHandle :=Wnd; end; if (pos('发送',S) =1) and (Pos('Button', C) =1) then begin if SendButtonNum=2 then SendButtonHandle:=wnd; SendButtonNum:= SendButtonNum+1; end; Result := True; end; //=====================定义一个回调函数===================
function EnumWindowsProc(Wnd: HWND; lParam: LPARAM): Boolean; stdcall; var S, C: String; begin S := GetWindowStr(Wnd); C := GetWindowClass(Wnd); //看是07和08版QQ的标题吗? if (Pos(WinCaption07, S) >0) or (Pos(WinCaption08, S) >0) then begin //如果找到QQ窗体则找出所有控件 if not EnumChildWindows(Wnd, @EnumChildProc, lParam) then ; Result := False; end; Result := True; end; //=====================主表单初始化=================== procedure TTform1.FormCreate(Sender: TObject); begin //初始化表单和列表框颜色 Tform1.color:=tcolor(rgb(236,233,216)); ListBox1.color:=Tcolor(rgb(96,96,97)); end;
//=====================查找QQ主窗体=================== procedure TTform1.FindBtnClick(Sender: TObject); begin X:=0; TextBoxNum:=1; SendButtonNum:=1;
try if not EnumWindows(@EnumWindowsProc, Integer(Pointer(ListBox1))) then ; finally if X = 0 then messagebox( Tform1.Handle,'不能找到QQ发送窗口!','错误',MB_OK+MB_DEFBUTTON1 +MB_ICONHAND); end; listbox1.ItemIndex:=0; if (QQInputBoxHandle<>0) and (SendButtonHandle <>0) then SendBtn.Enabled :=True; end;
//=====================装入聊天记录=================== procedure TTform1.LoadBtnClick(Sender: TObject); begin if bsSkinOpenDialog1.execute then begin ListBox1.Clear; ListBox1.Items.LoadFromFile(bsSkinOpenDialog1.filename); end; end;
//=====================可中断的连续发送================ procedure TTform1.SendBtnClick(Sender: TObject); var SendTxt:string; begin
StopSend := False; //把是否安暂停设为不停 if SendBtn.Caption='发 送' then begin SendBtn.Caption :='暂 停'; end else begin //如果是暂停按钮按下 SendBtn.Caption:='发 送'; StopSend:=True; end;
while (listbox1.ItemIndex<ListBox1.Items.Count-1) and (not StopSend) do begin listbox1.ItemIndex:=listbox1.ItemIndex+1;
//如果导入的文本文件里有空行,则跳过空行 while ListBox1.Items.strings[listbox1.ItemIndex]='' do listbox1.ItemIndex:=listbox1.ItemIndex+1;
if STopSend then exit; //如果暂停键按下 SendTxt :=ListBox1.Items.strings[listbox1.ItemIndex]; SendMessage(QQInputBoxHandle,EM_REPLACESEL,180,Integer(Pchar(SendTxt))); delay(300); SendMessage(SendButtonHandle,BM_CLICK,0,0); end; end;
procedure TTform1.AoutBtnClick(Sender: TObject); begin messagebox( Tform1.Handle,'QQ2008!','关于',MB_OK+MB_DEFBUTTON1 +MB_ICONQUESTION ); end;
end.
QQ2008自动聊天精灵delphi源码的更多相关文章
- [源码]Delphi源码免杀之函数动态调用 实现免杀的下载者
[免杀]Delphi源码免杀之函数动态调用 实现免杀的下载者 2013-12-30 23:44:21 来源:K8拉登哥哥's Blog 自己编译这份代码看看 过N多杀软 没什么技 ...
- 转换GMT秒数为日期时间格式-Delphi源码
转换GMT秒数为日期时间格式-Delphi源码.收藏最近在写PE分析工具的时候,需要转换TimeDateStamp字段值为日期时间格式,这是Delphi的源码. //把GMT时间的秒数转换成日期时间格 ...
- http代理工具delphi源码
http://www.caihongnet.com/content/xingyexinwen/2013/0721/730.html http代理工具delphi源码 以下代码在 DELPHI7+IND ...
- 【krpano】二维码自动生成插件(源码+介绍+预览)
简介 在krpano生成的全景支持HTML5在手机中展示,而在手机中打开全景网址时不方便,需要输入网址. 最近研究了如何让krpano全景根据自己当前的网址,自动生成二维码,并在电脑浏览时,可以展示出 ...
- Maven引入依赖后自动下载并关联源码(Source)
好多用 Maven 的时候会遇到这样一个棘手的问题: 就是添加依赖后由于没有下载并关联源码,导致自动提示无法出现正确的方法名,而且不安装反编译器的情况下不能进入方法内部看具体实现 . 其实 eclip ...
- Android接受验证码自动填入功能(源码+已实现+可用+版本兼容)
实际应用开发中,会经常用到短信验证的功能,这个时候如果再让用户就查看短信.然后再回到界面进行短信的填写,难免有多少有些不方便,作为开发者.本着用户至上的原则我们也应该来实现验证码的自动填写功能,还有一 ...
- IOS无限自动循环滚动banner(源码)
本文转载至 http://blog.csdn.net/iunion/article/details/19080259 目前有很多APP都开始使用一些滚动banner,我自己也做了一个,部分算法没有深 ...
- Eclipse_插件_05_自动下载jar包源码插件
一.Java Source Attacher 1.下载 官网:http://marketplace.eclipse.org/content/java-source-attacher#.U5RmTePp ...
- iOS精美过度动画、视频会议、朋友圈、联系人检索、自定义聊天界面等源码
iOS精选源码 iOS 精美过度动画源码 iOS简易聊天页面以及容联云IM自定义聊天页面的实现思路 自定义cell的列表视图实现:置顶.拖拽.多选.删除 SSSearcher仿微信搜索联系人,高亮搜索 ...
随机推荐
- spark学习12(Wordcount程序之spark-shell)
在目录/home/hadoop/2016113012下有文件words.txt hello scala hello java hello python hello wujiadong 上传该文件到hd ...
- 给定字符串数组,用map的key保存数组中字符串元素,value保存字符串元素出现次数,最后统计个字符串元素出现次数
import java.util.HashMap; public class map1 { public static void main(String[] args) { String[] arra ...
- NumPy矩阵库
NumPy - 矩阵库 NumPy 包包含一个 Matrix库numpy.matlib.此模块的函数返回矩阵而不是返回ndarray对象. matlib.empty() matlib.empty()函 ...
- No toolchains found in the NDK toolchains folder for ABI with prefix
通过Android Studio 的Sdk Manager安装NDK,安装完之后编译失败,报错信息如下: No toolchains found in the NDK toolchains folde ...
- yii2:多条件多where条件下碰到between时,between语句如何处理呢?
yii2:多条件多where条件下碰到between时,between语句如何处理呢? 我有一张表:id,name,telphone,ticket_no,status,create_time等字段, ...
- SSL HTTPS 生成证书
SSL HTTPS 一.生成服务器私钥.公钥 $ openssl genrsa -out server.key 2048 $ openssl rsa -in server.key -pubout -o ...
- JsonTools 工具类
import net.sf.json.JSONObject; public class JsonTools { public static JSONObject getJSONObject(Strin ...
- Chrome浏览器导入数字证书
1.打开 chrome ,点击 右上角的选项图标,在下拉列表中找到 设置 . 2.在设置页面中,滚动到页面的最底部,找到,并点击显示高级设置,找到 HTTPS/SSL 这一项,点击 管理证书 按键.
- IOS-将任意对象存进数据库
model // // HMShop.h // 将任意对象存进数据库 // // Created by apple on 14/11/20. // Copyright (c) 2014年 heima. ...
- VS10x CodeMap
VS10x CodeMap 注册码(key): #$aCN/L/ra73OaqCJENXc2JIDL61IMawNWBBX+PxhBzobE9w3QlcrwoXeB3DWBC2f56y9r0Hx2XP ...