关于QQ2004的问题(30分)

  • 主题发起人 主题发起人 sy0116
  • 开始时间 开始时间
S

sy0116

Unregistered / Unconfirmed
GUEST, unregistred user!
如何取得QQ2004发送消息的RICHEDIT里的文字?以前做过用于2003的,但到2004就不能用了,我不是要编尾巴,是朋友出的难题
 
http://www.playicq.com/dispdocnew.php?id=16129 这个可以的
 
主要代码如下,主要参考的就是 盒子上面的 灌水机 代码。<br>type<br>sendmsgthread=class(TThread)<br>public<br>procedure execute;override;<br>end;<br><br>var<br>&nbsp; Form1: TForm1;<br>&nbsp; qqformid:hwnd;<br>&nbsp; mysend:sendmsgthread;<br>//找到class是richedit的,发文本发给它。<br>function FmsgID(ahwnd:hwnd;w:integer):boolean;stdcall;<br>var<br>&nbsp; wintext:pchar;<br>begin<br>&nbsp; &nbsp; result:=true;<br>&nbsp; &nbsp; getmem(wintext,100);<br>&nbsp; &nbsp; getclassname(ahwnd,wintext,100);<br>&nbsp; &nbsp; if wintext='RICHEDIT' then<br>&nbsp; &nbsp; &nbsp; &nbsp; sendmessage(ahwnd,WM_settext,0,integer(pchar(form1.Memo1.lines.text)));<br>&nbsp; &nbsp; freemem(wintext);<br>end;<br><br>//找到发送按钮,点击他。<br>function FsendID(ahwnd:hwnd;w:integer):boolean;stdcall;<br>var<br>&nbsp; wintext:pchar;<br>begin<br>&nbsp; &nbsp; result:=true;<br>&nbsp; &nbsp; getmem(wintext,100);<br>&nbsp; &nbsp; getwindowtext(ahwnd,wintext,100);<br>&nbsp; &nbsp; if wintext='发送(&amp;S)' then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sendmessage(ahwnd,bm_click,0,0);<br>&nbsp; &nbsp; freemem(wintext);<br>end;<br><br>//找QQ聊天窗口<br>function FqqID(ahwnd:hwnd;w:integer):boolean;stdcall;<br>var<br>&nbsp; wintext:pchar;<br>begin<br>&nbsp; result:=true;<br>&nbsp; getmem(wintext,100);<br>&nbsp; getwindowtext(ahwnd,wintext,100);<br>&nbsp; if wintext='与 '+form1.Edit2.Text+' 聊天中' then<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; qqformid:=ahwnd;<br>&nbsp; enumchildwindows(qqformid,@fmsgid,0);<br>&nbsp; enumchildwindows(qqformid,@fsendid,0);<br>&nbsp; &nbsp; &nbsp; end;<br>end;<br>//用线程发送消息。<br>procedure sendmsgthread.execute;<br>var<br>&nbsp; i:integer;<br>begin<br>&nbsp; FreeOnTerminate:=True;<br>&nbsp; for i:=1 to strtoint(Form1.Edit1.text) do<br>&nbsp; begin<br>&nbsp; &nbsp; if terminated then exit;<br>&nbsp; &nbsp; qqformid:=0;<br>&nbsp; &nbsp; enumwindows(@fqqid,0);<br>&nbsp; &nbsp; if qqformid=0 then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; Messagebox(0,'没有找到对话模式窗口','注意',0);<br>&nbsp; &nbsp; &nbsp; form1.button2.Enabled:=false;<br>&nbsp; &nbsp; &nbsp; form1.button1.Enabled:=true;<br>&nbsp; &nbsp; &nbsp; exit;<br>&nbsp; &nbsp; end;<br>&nbsp; &nbsp; sleep(StrToInt(form1.Edit3.text));//暂停时间<br>&nbsp; end;<br>&nbsp; form1.button1.Enabled:=true;<br>&nbsp; form1.button2.Enabled:=false;<br>end;<br>//sendmsgthread.Create(false);即可启动线程
 
后退
顶部