-------------------Delphi版的:--------------
program chat2001;
uses
windows,messages,sysutils;
{$R *.RES}
const
CRLF=#13#10;
exename:pchar=''刷屏机器人 2001'';
var
//----------------------
wClass: TWndClass; //窗口类变量
Msg: TMSG; //消息变量
hInst, //
程序实例
Handle, //主窗口句柄
hFont, //字体句柄
//----------------
hButtonStart, //开始按钮
hButtonStop, //停止按钮
hButtonHelp, //帮助按钮
hButtonExit, //退出按钮
hEditEmail, //e-mail编辑
hLabelEmail, //e-mail提示
mcount,tempwnd,qqmainw,richedit:integer;
lp:longint;
newtime:integer;
//--------------------
//往一个窗口写标题
procedure WriteCaption(hwnd:hwnd;text:pchar);begin sendmessage(hwnd,WM_SETTEXT,0,integer(text));end;
//从一个窗口读标题
procedure ReadCaption(hwnd:hwnd;text:pchar);begin sendmessage(hwnd,WM_GETTEXT,400,integer(text));end;
procedure ButtonHelp;
var s1:string;
begin
s1:=''本软件只用
学习用,不可害人''+CRLF+
''
程序向QQ2000B的输入框中输入文字并发送!''+CRLF+
''详细
资料,及源码在作者主页上''+CRLF+
''主页:hotsky.363.net''+CRLF;
messagebox(handle,pchar(s1),''帮助'',0);
end;
//主
程序结束
procedure ShutDown;
begin
//删除字体对象
DeleteObject(hFont);
//取消窗口类的
注册 UnRegisterClass(wClass.lpszClassName,hInst);
//结束主进程
ExitProcess(hInst);
end;
procedure ontimer;
var
len:integer;
str:array[0..500] of char;
begin
inc(mcount);
//strcopy(str,pchar(format(''我是 %d 号刷屏机器人'',[mcount])));
readCaption(heditemail,str);
strcopy(str,pchar(format(''我是 %d 号刷屏机器人'',[mcount])));
if (mcount mod 2)<>0 then
begin
len:=strlen(str);
str[len]:='' '';
str[len+1]:=#0;
end;
qqmainw:=FindWindow(''AfxFrameOrView42s'',nil);
qqmainw:=FindWindowEx(qqmainw,0,''AfxMDIFrame42s'',nil);
qqmainw:=FindWindowEx(qqmainw,0,''AfxFrameOrView42s'',nil);
qqmainw:=GetNextWindow(qqmainw,GW_HWNDNEXT);
qqmainw:=FindWindowEx(qqmainw,0,''#32770'',nil);
richedit:=FindWindowEx(qqmainw,0,''RICHEDIT'',nil);
// SetFocus(richedit);
SendMessage(richedit,EM_SETSEL,0,-1);
SendMessage(richedit,EM_REPLACESEL,1,integer(@str));
PostMessage(richedit,WM_KEYDOWN ,VK_RETURN,$001c0001);
PostMessage(richedit,WM_KEYUP,VK_RETURN,$c01c0001);
strcopy(str,pchar(format(''我是 %d 号刷屏机器人'',[mcount])));
writeCaption(hlabelemail,str);
end;
//这是主窗口的消息处理函数
function WindowProc(hWnd,Msg,wParam,lParam:integer):Longint; stdcall;
begin
Result:=DefWindowProc(hWnd,Msg,wParam,lParam);
case Msg of
WM_COMMAND:
begin
if lParam=hButtonStart then begin mcount:=0;newtime:=SetTimer(handle,100,2950,nil); end;
if lParam=hButtonStop then begin mcount:=0;killtimer(handle,newtime); end;
if lParam=hButtonHelp then ButtonHelp;
if lParam=hButtonExit then ShutDown;
end;
WM_TIMER:ontimer;
WM_DESTROY: ShutDown;
end;
en