vb.net做一个MSN灌水机

Public   Class Form1
    
Inherits System.Windows.Forms.Form


Windows 窗体设计器生成的代码

    
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        
'If lbxprocess.SelectedItem = "" Then
            ' MessageBox.Show(lbxprocess.Items(0))
            'End If

        
If lbxprocess.Items.Count > 0 Then
            
Try
                
AppActivate(lbxprocess.Items(0))
                
' MessageBox.Show(txtsendtxt.Text)
                Dim i As Integer
                
Dim c As Clipboard
                c.SetDataObject(txtsendtxt.Text)
                
For i = 1 To CInt(txtsendtimes.Text)
                    
Dim s As SendKeys
                    s.Send(
"^V")
                    s.Send(
"{Enter}")
                
Next
            
Finally
                
'MessageBox.Show("Error!")
            End Try
        
Else
            
Call getProcessList()
        
End If

    
End Sub


    
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        
Call Button2_Click(Me, e)
    
End Sub


    
Private Sub getProcessList()
        
Dim p As Process()
        
Dim inst As Process
        p 
= Process.GetProcessesByName("msnmsgr")
        lbxprocess.Items.Clear()
        
For Each inst In p
            
If inst.MainWindowTitle <> "MSN Messager" Then
                lbxprocess.Items.Add(inst.MainWindowTitle)
            
End If
        
Next
    
End Sub


    
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        
Dim p As Process()
        
Dim inst As Process
        p 
= Process.GetProcessesByName("msnmsgr")
        lbxprocess.Items.Clear()
        
For Each inst In p
            
If inst.MainWindowTitle <> "MSN Messager" Then
                lbxprocess.Items.Add(inst.MainWindowTitle)
            
End If
        
Next
    
End Sub


    
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        
If Timer1.Enabled = False Then
            txtsendtimes.Text 
= "1"
            Timer1.Interval 
= CType(txttimer.Text, Integer* 1000
            Timer1.Enabled 
= True
            Button3.Text 
= "停止"
        
Else
            Timer1.Enabled 
= False
            Button3.Text 
= "开始"
        
End If
    
End Sub


    
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        
Call Button1_Click(Me, e)
    
End Sub

End Class

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值