program QQmsg;<br><br>uses<br> Windows,<br> Messages;<br><br>const<br> s1:string='尊敬的用户您好:您的话费余额已不足0.1元,请您在近日内:卖儿卖女卖大米,砸锅卖铁卖点儿血,卖房卖地卖老婆,把话费交上。谢谢合作!你的主人!';<br> s2:string='我是一棵葱,站在风雨中,谁要拿我沾大酱我操他老祖宗!走过南闯过北,厕所后面喝过水,火车道上压过腿,还和傻子亲过嘴。操!啥也不拒,就是想';<br> s3:string='恋爱了吧!高兴了吧!从此花钱大了吧!结婚了吧!爽了吧!从此有人管了吧!离婚了吧!自由了吧!做爱要花钱了吧!艾滋了吧!傻了吧!躺在床上等死吧!';<br> s4:string='我一直都守在你身边,也一再为你担心,今天你吃得饱吗?睡得好吗?深夜会冷吗?我向来都知道你就是不会照顾自己,每当我一走开,你就从猪栏跳出去。';<br> s5:string='二他骂,泥介四赶骂七呀?”“桑发员达管斯七!”“原高被高?”“原高!”“原高,够牛笔地呀!”“牛笔骂呀,被强见了!”';<br> var<br> TimerHandle:WORD;<br> MSG:TMSG;<br> n:integer;<br><br><br>procedure TimerProc(Wnd:HWnd;Msg,TimerID,dwTime
WORD);stdcall;<br>var<br> hLastWin,hButton : THandle;<br> szWindowText: array[0..MAX_PATH] of Char;<br> szTextLength: Integer;<br> QQName,tem:String;<br>begin<br> hLastWin := GetForegroundWindow;<br> GetClassName(hLastWin,szWindowText,SizeOf(szWindowText));<br> if szWindowText <>'#32770' then Exit;<br> szTextLength := SendMessage(hLastWin, WM_GETTEXT, MAX_PATH, Integer(@szWindowText[0]));<br> szWindowText[szTextLength] := #0;<br> if Pos('聊天中',szWindowText)>0 then<br> begin<br> QQName:=Copy(szWindowText,Pos(' ',szWindowText)+1,Pos('聊天中',szWindowText)-Pos(' ',szWindowText)-2);<br> hLastWin := FindWindowEx(hLastWin, THandle(nil),'#32770',nil);<br> if hLastWin=0 then Exit;<br> hButton := FindWindowEx(hLastWin, THandle(nil),nil,'发送(&S)');<br> if hButton=0 then Exit; <br> hLastWin := FindWindowEx(hLastWin, THandle(nil),'AfxWnd42',nil);<br> if hLastWin=0 then Exit;<br> hLastWin := FindWindowEx(hLastWin, THandle(nil),'RICHEDIT',nil);<br> if hLastWin=0 then Exit;<br> n:=n+1;<br> case n of<br> 1:tem:=s1;<br> 2:tem:=s2;<br> 3:tem:=s3;<br> 4:tem:=s4;<br> 5:tem:=s5;<br> else<br> tem:='程序出错了,不好意思!';<br> end;<br> if n=5 then<br> n:=0;<br> QQName:=QQName+tem;<br> SendMessage(hLastWin,EM_REPLACESEL,180,Integer(Pchar(QQName)));<br> SendMessage(hButton, WM_LBUTTONDOWN, 0, 0);<br> SendMessage(hButton, WM_LBUTTONUP, 0, 0);<br> end;<br>end;<br><br>procedure StartTimer(Interval
WORD);<br>begin<br> TimerHandle:=SetTimer(0,0,Interval,@TimerProc);<br>end;<br><br>begin<br> n:=0;<br> StartTimer(200);<br> while(GetMessage(Msg,0,0,0))do<br> begin<br> TranslateMessage(Msg);<br> DispatchMessage(Msg);<br> end;<br>end.