InPowerS.Net

 找回密碼
 註冊
搜索
查看: 5073|回復: 0

QQ消息轟炸機原始程式碼

[複製鏈接]
發表於 2008-12-25 22:17:13 | 顯示全部樓層 |閱讀模式
'***************************************
'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
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.ButtonRefresh = New System.Windows.Forms.Button
        Me.ButtonStart = New System.Windows.Forms.Button
        Me.TextBox1 = New System.Windows.Forms.TextBox
        Me.Label1 = New System.Windows.Forms.Label
        Me.GroupBox1 = New System.Windows.Forms.GroupBox
        Me.ListView1 = New System.Windows.Forms.ListView
        Me.RadioButton2 = New System.Windows.Forms.RadioButton
        Me.RadioButton1 = New System.Windows.Forms.RadioButton
        Me.ButtonStop = New System.Windows.Forms.Button
        Me.Label3 = New System.Windows.Forms.Label
        Me.GroupBox1.SuspendLayout()
        Me.SuspendLayout()
        '
        'ButtonRefresh
        '
        Me.ButtonRefresh.Location = New System.Drawing.Point(16, 80)
        Me.ButtonRefresh.Name = "ButtonRefresh"
        Me.ButtonRefresh.Size = New System.Drawing.Size(56, 24)
        Me.ButtonRefresh.TabIndex = 0
        Me.ButtonRefresh.Text = "刷新"
        '
        'ButtonStart
        '
        Me.ButtonStart.Location = New System.Drawing.Point(16, 116)
        Me.ButtonStart.Name = "ButtonStart"
        Me.ButtonStart.Size = New System.Drawing.Size(56, 24)
        Me.ButtonStart.TabIndex = 1
        Me.ButtonStart.Text = "開始"
        '
        'TextBox1
        '
        Me.TextBox1.AutoSize = False
        Me.TextBox1.Location = New System.Drawing.Point(16, 216)
        Me.TextBox1.Multiline = True
        Me.TextBox1.Name = "TextBox1"
        Me.TextBox1.Size = New System.Drawing.Size(256, 88)
        Me.TextBox1.TabIndex = 3
        Me.TextBox1.Text = "/cy 轟炸美國,從你開始. "
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.Location = New System.Drawing.Point(24, 200)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(91, 17)
        Me.Label1.TabIndex = 4
        Me.Label1.Text = "請輸入發送內容"
        '
        'GroupBox1
        '
        Me.GroupBox1.Controls.Add(Me.ListView1)
        Me.GroupBox1.Controls.Add(Me.RadioButton2)
        Me.GroupBox1.Controls.Add(Me.RadioButton1)
        Me.GroupBox1.Controls.Add(Me.ButtonStop)
        Me.GroupBox1.Controls.Add(Me.ButtonStart)
        Me.GroupBox1.Controls.Add(Me.ButtonRefresh)
        Me.GroupBox1.Location = New System.Drawing.Point(16, 8)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(248, 184)
        Me.GroupBox1.TabIndex = 9
        Me.GroupBox1.TabStop = False
        '
        'ListView1
        '
        Me.ListView1.CheckBoxes = True
        Me.ListView1.Location = New System.Drawing.Point(96, 24)
        Me.ListView1.Name = "ListView1"
        Me.ListView1.Size = New System.Drawing.Size(144, 152)
        Me.ListView1.TabIndex = 12
        Me.ListView1.View = System.Windows.Forms.View.List
        '
        'RadioButton2
        '
        Me.RadioButton2.Location = New System.Drawing.Point(12, 40)
        Me.RadioButton2.Name = "RadioButton2"
        Me.RadioButton2.Size = New System.Drawing.Size(88, 24)
        Me.RadioButton2.TabIndex = 1
        Me.RadioButton2.Text = "直到我叫停"
        '
        'RadioButton1
        '
        Me.RadioButton1.Checked = True
        Me.RadioButton1.Location = New System.Drawing.Point(12, 17)
        Me.RadioButton1.Name = "RadioButton1"
        Me.RadioButton1.Size = New System.Drawing.Size(88, 24)
        Me.RadioButton1.TabIndex = 0
        Me.RadioButton1.TabStop = True
        Me.RadioButton1.Text = "只發一次"
        '
        'ButtonStop
        '
        Me.ButtonStop.Location = New System.Drawing.Point(16, 152)
        Me.ButtonStop.Name = "ButtonStop"
        Me.ButtonStop.Size = New System.Drawing.Size(56, 24)
        Me.ButtonStop.TabIndex = 11
        Me.ButtonStop.Text = "停止"
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(96, 312)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(184, 24)
        Me.Label3.TabIndex = 10
        Me.Label3.Text = "---自由奔騰 wgscd----"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.BackColor = System.Drawing.Color.SkyBlue
        Me.ClientSize = New System.Drawing.Size(280, 325)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.TextBox1)
        Me.Controls.Add(Me.GroupBox1)
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "Form1"
        Me.Text = "QQ消息群炸機"
        Me.GroupBox1.ResumeLayout(False)
        Me.ResumeLayout(False)
    End Sub
#End Region
    Private Sub ButtonRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonRefresh.Click
        ListView1.Items.Clear()  '清除元素
        ''''''''''''''''''''''''''''''''''''''''''''''''
        hwnd = 0
        i = 0
        Dim str As String
        While 1
            hwnd = FindWindowEx(0, hwnd, "#32770", vbNullString)
            If hwnd = 0 Then
                Exit While
            Else
                Str = New String(Chr(0), 50)
                GetWindowText(hwnd, Str, 50)
                Str = Str.TrimEnd(Chr(0))
                If Str.StartsWith("與 ") And Str.EndsWith(" 聊天中") Then
                    '聊天主視窗hwnd--子視窗hwnd2(發送BUTTON 和 hwnd3 的父視窗)--hwnd3(文本編輯方塊的父視窗)--文本編輯視窗控制碼
                    hWndTalk(i) = hwnd      '聊天主窗口控制碼
                    hwnd2 = FindWindowEx(hwnd, 0, "#32770", vbNullString)   '發送按鈕 和 文本編輯方塊 的父視窗
                    '''''''''''''''''''''''''''''''''''''''''''
                    hWndSend(i) = FindWindowEx(hwnd2, 0, vbNullString, "發送(&s)")   '發送BUTTON 控制碼
                    '''''''''''''''''''''''''''''''''''''''''''
                    hwnd3 = FindWindowEx(hwnd2, 0, "AfxWnd42", vbNullString)         '文本編輯方塊的父視窗
                    hWndEdit(i) = FindWindowEx(hwnd3, 0, "RICHEDIT", vbNullString)   '文本編輯方塊的控制碼
                    '''''''''''''''''''''''''''''''''''
                    i += 1
                    Str = Str.Substring(2)
                    Str = Str.Replace(" 聊天中", "")
                    Dim item As Windows.Forms.ListViewItem
                    item = ListView1.Items.Add(Str)
                    item.Checked = True
                    '''''''''''''''''''''''''''''''''''
                End If
            End If
        End While
    End Sub
    Private Sub ButtonStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonStop.Click
        If (Not MyThread Is Nothing) Then
            MyThread.Abort()
        End If
        ButtonStart.Enabled = True
    End Sub
    Private Sub ButtonStart_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButtonStart.Click
        sMess = Me.TextBox1.Text.ToString
        If sMess = "" Then
            MsgBox("請輸入發送內容!")
            Exit Sub
        End If
        ''''''''''''''''''''''''''''''''''''''''''''''''''''''''
        '以下求延遲毫秒數
        iDelay = 0
        For i = 0 To ListView1.Items.Count - 1
            If ListView1.Items(i).Checked = True Then
                iDelay += 1         '共有多少個視窗,要發送資訊
            End If
        Next
        If iDelay = 0 Then
            MsgBox("請選擇至少一個聊天物件,必須打開聊天視窗,再按刷新即可。")
            Exit Sub
        End If
        iDelay = 3100 - iDelay * 1000   '延遲多少秒,發送的窗口越少,延遲秒數越大
        If iDelay < 0 Then
            iDelay = 0
        End If
        ''''''''''''''''''''''''''''''''''''''''''''''''''''''''
        If RadioButton1.Checked Then    '只發一次
            SendMess()
        Else                            '不停地發,直到用戶中止
            MyThread = New Threading.Thread(AddressOf SendMessUntil)
            MyThread.Start()
            ButtonStart.Enabled = False
        End If
    End Sub
    Private Sub SendMess()
        For i = 0 To ListView1.Items.Count - 1
            If ListView1.Items(i).Checked = True Then
                SendMessage(hWndEdit(i), WM_SETTEXT, 0, sMess & "hhhhhhhh")
                System.Threading.Thread.Sleep(iDelay)
                SendMessage(hWndSend(i), WM_LBUTTONDOWN, 0, 0)
                SendMessage(hWndSend(i), WM_LBUTTONUP, 0, 0)
            End If
        Next
    End Sub
    Private Sub SendMessUntil()
        While 1
            SendMess()
        End While
    End Sub
    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ButtonRefresh_Click(Nothing, Nothing)
    End Sub
    Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
        If (Not MyThread Is Nothing) Then
            MyThread.Abort()
        End If
    End Sub
End Class
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

小黑屋|Archiver|手機版|InPowerS.Net

GMT+8, 2024-3-29 01:47

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回復 返回頂部 返回列表