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仿微信搜索联系人,高亮搜索 ...
随机推荐
- HBase 协处理器---基本概念和regionObserver的简单实现
1. 简介 对于HBase的协处理器概念可由其官方博文了解:https://blogs.apache.org/hbase/entry/coprocessor_introduction 总体来说其包含两 ...
- Oracle 配置tnsnames.ora
之所以要配置这个文件,是因为里面有配置数据库 服务器的地址. 目录: E:\app\PC-Gang\product\11.2.0\dbhome_1\NETWORK\ADMIN
- spring cloud 基本小结
Spring cloud系列十四 分布式链路监控Spring Cloud Sleuth https://blog.csdn.net/hry2015/article/details/78905489 S ...
- tyvj 1059 过河 dp
P1059 过河 时间: 1000ms / 空间: 131072KiB / Java类名: Main 背景 NOIP2005 提高组 第二道 描述 在河上有一座独木桥,一只青蛙想沿着独木桥从河的一侧跳 ...
- JNIjw05
ZC: 这个代码,没有真正的运行测试 1.VC6(CPP)的DLL代码: #include<stdio.h> #include "jniZ_JNIjw05.h" #in ...
- JNIjw04
1.VC6(CPP)的DLL代码: #include<stdio.h> #include "jniZ_JNIjw04.h" #include <string> ...
- mooseFS学习篇
官方网站:http://www.moosefs.org/ About MooseFS MooseFS is a fault tolerant, network distributed file sys ...
- request_irq() | 注册中断服务
一.中断注册方法 在linux内核中用于申请中断的函数是request_irq(),函数原型在Kernel/irq/manage.c中定义: int request_irq(unsigned int ...
- 边缘检测︱基于 HED网络TensorFlow 和 OpenCV 实现图片边缘检测
本文摘录自<手机端运行卷积神经网络的一次实践 – 基于 TensorFlow 和 OpenCV 实现文档检测功能> 只截取感兴趣 的片段. . 一.边缘检测 1.传统边缘检测 Google ...
- 移动元素时,translate要比margin好
比如 做全屏轮播时,父元素往往是被子元素撑起来的,那你设置父元素的margin时,往往会感染到子元素,如下图: 而用translate3d就不会出现这种效果: