QQ消息轰炸机源代码(VB.NET)

'***************************************
'QQ消息轰炸机源代码(VB.NET)
'wgscd 2005-1-1

'***************************************
Public Class Form1
Inherits System.Windows.Forms.Form
Private Declare Function FindWindowEx Lib "user32.dll" Alias "FindWindowExA" (ByVal hWnd1 As Int32, ByVal hWnd2 As Int32, ByVal lpsz1 As String, ByVal lpsz2 As String) As Int32
Private Declare Function GetWindowText Lib "user32.dll" Alias "GetWindowTextA" (ByVal hwnd As Int32, ByVal lpString As String, ByVal cch As Int32) As Int32
Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Int32
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Int32, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal lParam As Int32) As Int32
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Int32, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal lParam As String) As Int32
'Private Const WM_PASTE As Int32 = &H302
Private Const WM_SETTEXT As Int32 = &HC
Private Const WM_KEYDOWN As Int32 = &H100
Private Const WM_KEYUP As Int32 = &H101
Private Const WM_LBUTTONDOWN As Int32 = &H201
Private Const WM_LBUTTONUP As Int32 = &H202

'Private Const WM_SHOWWINDOW As Int32 = &H18
Private Const SW_NORMAL As Int32 = 1
Private Declare Function ShowWindow Lib "user32.dll" (ByVal hwnd As Int32, ByVal nCmdShow As Int32) As Int32
'Private Declare Function GetLastError Lib "kernel32.dll" () As Int32
Private Const SW_SHOWNOACTIVATE As Int32 = 4
Private Declare Function SetWindowText Lib "user32.dll" Alias "SetWindowTextA" (ByVal hwnd As Int32, ByVal lpString As String) As Int32
Private Const SW_HIDE As Int32 = 0
Private Const SW_SHOW As Int32 = 5

Dim sMess As String
Dim hwnd, hwnd2, hwnd3, i, iDelay As Int32
Dim hWndTalk(20), hWndEdit(20), hWndSend(20) As Int32
Dim MyThread As Threading.Thread
#Region " Windows 窗体设计器生成的代码 "

Public Sub New()
MyBase.New()

'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()

'在 InitializeComponent() 调用之后添加任何初始化

End Sub

'窗体重写 dispose 以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer

'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。

Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents ButtonRefresh As System.Windows.Forms.Button
Friend WithEvents ButtonStart As System.Windows.Forms.Button
Friend WithEvents ButtonStop As System.Windows.Forms.Button
Friend WithEvents RadioButton1 As System.Windows.Forms.RadioButton
Friend WithEvents RadioButton2 As System.Windows.Forms.RadioButton
Friend WithEvents ListView1 As System.Windows.Forms.ListView

  1<system.diagnostics.debuggerstepthrough()> Private Sub InitializeComponent()   
  2Me.ButtonRefresh = New System.Windows.Forms.Button   
  3Me.ButtonStart = New System.Windows.Forms.Button   
  4Me.TextBox1 = New System.Windows.Forms.TextBox   
  5Me.Label1 = New System.Windows.Forms.Label   
  6Me.GroupBox1 = New System.Windows.Forms.GroupBox   
  7Me.ListView1 = New System.Windows.Forms.ListView   
  8Me.RadioButton2 = New System.Windows.Forms.RadioButton   
  9Me.RadioButton1 = New System.Windows.Forms.RadioButton   
 10Me.ButtonStop = New System.Windows.Forms.Button   
 11Me.Label3 = New System.Windows.Forms.Label   
 12Me.GroupBox1.SuspendLayout()   
 13Me.SuspendLayout()   
 14'   
 15'ButtonRefresh   
 16'   
 17Me.ButtonRefresh.Location = New System.Drawing.Point(16, 80)   
 18Me.ButtonRefresh.Name = "ButtonRefresh"   
 19Me.ButtonRefresh.Size = New System.Drawing.Size(56, 24)   
 20Me.ButtonRefresh.TabIndex = 0   
 21Me.ButtonRefresh.Text = "刷新"   
 22'   
 23'ButtonStart   
 24'   
 25Me.ButtonStart.Location = New System.Drawing.Point(16, 116)   
 26Me.ButtonStart.Name = "ButtonStart"   
 27Me.ButtonStart.Size = New System.Drawing.Size(56, 24)   
 28Me.ButtonStart.TabIndex = 1   
 29Me.ButtonStart.Text = "开始"   
 30'   
 31'TextBox1   
 32'   
 33Me.TextBox1.AutoSize = False   
 34Me.TextBox1.Location = New System.Drawing.Point(16, 216)   
 35Me.TextBox1.Multiline = True   
 36Me.TextBox1.Name = "TextBox1"   
 37Me.TextBox1.Size = New System.Drawing.Size(256, 88)   
 38Me.TextBox1.TabIndex = 3   
 39Me.TextBox1.Text = "/cy 轰炸美国,从你开始. "   
 40'   
 41'Label1   
 42'   
 43Me.Label1.AutoSize = True   
 44Me.Label1.Location = New System.Drawing.Point(24, 200)   
 45Me.Label1.Name = "Label1"   
 46Me.Label1.Size = New System.Drawing.Size(91, 17)   
 47Me.Label1.TabIndex = 4   
 48Me.Label1.Text = "请输入发送内容"   
 49'   
 50'GroupBox1   
 51'   
 52Me.GroupBox1.Controls.Add(Me.ListView1)   
 53Me.GroupBox1.Controls.Add(Me.RadioButton2)   
 54Me.GroupBox1.Controls.Add(Me.RadioButton1)   
 55Me.GroupBox1.Controls.Add(Me.ButtonStop)   
 56Me.GroupBox1.Controls.Add(Me.ButtonStart)   
 57Me.GroupBox1.Controls.Add(Me.ButtonRefresh)   
 58Me.GroupBox1.Location = New System.Drawing.Point(16, 8)   
 59Me.GroupBox1.Name = "GroupBox1"   
 60Me.GroupBox1.Size = New System.Drawing.Size(248, 184)   
 61Me.GroupBox1.TabIndex = 9   
 62Me.GroupBox1.TabStop = False   
 63'   
 64'ListView1   
 65'   
 66Me.ListView1.CheckBoxes = True   
 67Me.ListView1.Location = New System.Drawing.Point(96, 24)   
 68Me.ListView1.Name = "ListView1"   
 69Me.ListView1.Size = New System.Drawing.Size(144, 152)   
 70Me.ListView1.TabIndex = 12   
 71Me.ListView1.View = System.Windows.Forms.View.List   
 72'   
 73'RadioButton2   
 74'   
 75Me.RadioButton2.Location = New System.Drawing.Point(12, 40)   
 76Me.RadioButton2.Name = "RadioButton2"   
 77Me.RadioButton2.Size = New System.Drawing.Size(88, 24)   
 78Me.RadioButton2.TabIndex = 1   
 79Me.RadioButton2.Text = "直到我叫停"   
 80'   
 81'RadioButton1   
 82'   
 83Me.RadioButton1.Checked = True   
 84Me.RadioButton1.Location = New System.Drawing.Point(12, 17)   
 85Me.RadioButton1.Name = "RadioButton1"   
 86Me.RadioButton1.Size = New System.Drawing.Size(88, 24)   
 87Me.RadioButton1.TabIndex = 0   
 88Me.RadioButton1.TabStop = True   
 89Me.RadioButton1.Text = "只发一次"   
 90'   
 91'ButtonStop   
 92'   
 93Me.ButtonStop.Location = New System.Drawing.Point(16, 152)   
 94Me.ButtonStop.Name = "ButtonStop"   
 95Me.ButtonStop.Size = New System.Drawing.Size(56, 24)   
 96Me.ButtonStop.TabIndex = 11   
 97Me.ButtonStop.Text = "停止"   
 98'   
 99'Label3   
100'   
101Me.Label3.Location = New System.Drawing.Point(96, 312)   
102Me.Label3.Name = "Label3"   
103Me.Label3.Size = New System.Drawing.Size(184, 24)   
104Me.Label3.TabIndex = 10   
105Me.Label3.Text = "---自由奔腾 wgscd----"   
106'   
107'Form1   
108'   
109Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)   
110Me.BackColor = System.Drawing.Color.SkyBlue   
111Me.ClientSize = New System.Drawing.Size(280, 325)   
112Me.Controls.Add(Me.Label3)   
113Me.Controls.Add(Me.Label1)   
114Me.Controls.Add(Me.TextBox1)   
115Me.Controls.Add(Me.GroupBox1)   
116Me.MaximizeBox = False   
117Me.MinimizeBox = False   
118Me.Name = "Form1"   
119Me.Text = "QQ消息群炸机"   
120Me.GroupBox1.ResumeLayout(False)   
121Me.ResumeLayout(False) 
122
123End Sub 
124
125#End Region 
126
127Private Sub ButtonRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonRefresh.Click   
128ListView1.Items.Clear() '清除元素   
129''''''''''''''''''''''''''''''''''''''''''''''''   
130hwnd = 0   
131i = 0   
132Dim str As String   
133While 1   
134hwnd = FindWindowEx(0, hwnd, "#32770", vbNullString)   
135If hwnd = 0 Then   
136Exit While   
137Else   
138Str = New String(Chr(0), 50)   
139GetWindowText(hwnd, Str, 50)   
140Str = Str.TrimEnd(Chr(0))   
141If Str.StartsWith("与 ") And Str.EndsWith(" 聊天中") Then   
142'聊天主窗口hwnd--子窗口hwnd2(发送BUTTON 和 hwnd3 的父窗口)--hwnd3(文本编辑框的父窗口)--文本编辑窗口句柄   
143hWndTalk(i) = hwnd '聊天主窗口句柄   
144hwnd2 = FindWindowEx(hwnd, 0, "#32770", vbNullString) '发送按钮 和 文本编辑框 的父窗口   
145'''''''''''''''''''''''''''''''''''''''''''   
146hWndSend(i) = FindWindowEx(hwnd2, 0, vbNullString, "发送(&amp;s)") '发送BUTTON 句柄   
147'''''''''''''''''''''''''''''''''''''''''''   
148hwnd3 = FindWindowEx(hwnd2, 0, "AfxWnd42", vbNullString) '文本编辑框的父窗口   
149hWndEdit(i) = FindWindowEx(hwnd3, 0, "RICHEDIT", vbNullString) '文本编辑框的句柄   
150'''''''''''''''''''''''''''''''''''   
151i += 1   
152Str = Str.Substring(2)   
153Str = Str.Replace(" 聊天中", "")   
154Dim item As Windows.Forms.ListViewItem   
155item = ListView1.Items.Add(Str)   
156item.Checked = True   
157'''''''''''''''''''''''''''''''''''   
158End If   
159End If   
160End While 
161
162End Sub 
163
164Private Sub ButtonStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonStop.Click   
165If (Not MyThread Is Nothing) Then   
166MyThread.Abort()   
167End If   
168ButtonStart.Enabled = True   
169End Sub 
170
171Private Sub ButtonStart_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButtonStart.Click   
172sMess = Me.TextBox1.Text.ToString   
173If sMess = "" Then   
174MsgBox("请输入发送内容!")   
175Exit Sub   
176End If   
177''''''''''''''''''''''''''''''''''''''''''''''''''''''''   
178'以下求延迟毫秒数   
179iDelay = 0   
180For i = 0 To ListView1.Items.Count - 1   
181If ListView1.Items(i).Checked = True Then   
182iDelay += 1 '共有多少个窗口,要发送信息   
183End If   
184Next   
185If iDelay = 0 Then   
186MsgBox("请选择至少一个聊天对象,必须打开聊天窗口,再按刷新即可。")   
187Exit Sub   
188End If   
189iDelay = 3100 - iDelay * 1000 '延迟多少秒,发送的窗口越少,延迟秒数越大   
190If iDelay &lt; 0 Then   
191iDelay = 0   
192End If   
193''''''''''''''''''''''''''''''''''''''''''''''''''''''''   
194If RadioButton1.Checked Then '只发一次   
195SendMess()   
196Else '不停地发,直到用户中止   
197MyThread = New Threading.Thread(AddressOf SendMessUntil)   
198MyThread.Start()   
199ButtonStart.Enabled = False   
200End If   
201End Sub   
202Private Sub SendMess()   
203For i = 0 To ListView1.Items.Count - 1   
204If ListView1.Items(i).Checked = True Then   
205SendMessage(hWndEdit(i), WM_SETTEXT, 0, sMess &amp; "hhhhhhhh")   
206System.Threading.Thread.Sleep(iDelay)   
207SendMessage(hWndSend(i), WM_LBUTTONDOWN, 0, 0)   
208SendMessage(hWndSend(i), WM_LBUTTONUP, 0, 0)   
209End If   
210Next   
211End Sub   
212Private Sub SendMessUntil()   
213While 1   
214SendMess()   
215End While   
216End Sub 
217
218Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load   
219ButtonRefresh_Click(Nothing, Nothing)   
220End Sub 
221
222Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing   
223If (Not MyThread Is Nothing) Then   
224MyThread.Abort()   
225End If   
226End Sub 
227
228End Class</system.diagnostics.debuggerstepthrough()>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus