webbrowser控件代码

前端之家收集整理的这篇文章主要介绍了webbrowser控件代码前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。



最多连续两回复。10秒内不得发两贴。

Public Class Form1
    Private blnSend As Boolean = False '发送检测
    Private blnCheck As Boolean = False '别人检测
    Private iCountSend As Integer = 0    '发送次数

    Private Sub Timer1_Tick(sender As Object,e As EventArgs) Handles Timer1.Tick
        WebBrowser1.Navigate("http://www.myboyan.com/yule/")
    End Sub

    Private Sub Timer2_Tick(sender As Object,e As EventArgs) Handles Timer2.Tick
        blnSend = True
        WebBrowser2.Navigate("http://www.myboyan.com/yule/b825399/")

        Timer2.Enabled = False
    End Sub

    Private Sub WebBrowser1_DocumentCompleted(sender As Object,e As WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
        If blnCheck = False Then
            Exit Sub
        Else
            If Not WebBrowser1.IsBusy And WebBrowser1.ReadyState = WebBrowserReadyState.Complete Then
                Dim Table As HtmlElement = WebBrowser1.Document.All("td_825399")
                WebBrowser1.Document.GetElementById("td_825399").Focus()
                If Table Is Nothing Then Exit Sub
                Table = Table.NextSibling
                Table = Table.NextSibling
                Table = Table.NextSibling
                TextBox1.Text = Table.InnerText

                If InStr(TextBox1.Text,"dzweather") = 0 Then
                    blnCheck = False
                    Timer1.Enabled = False
                    blnSend = True
                    iCountSend = 0
                    WebBrowser2.Navigate("http://www.myboyan.com/yule/b825399/")
                End If
            End If
        End If
    End Sub

    Private Sub WebBrowser2_DocumentCompleted(sender As Object,e As WebBrowserDocumentCompletedEventArgs) Handles WebBrowser2.DocumentCompleted
        If blnSend = False Then
            Exit Sub
        Else
            If Not WebBrowser2.IsBusy And WebBrowser2.ReadyState = WebBrowserReadyState.Complete Then
                blnSend = False
                WebBrowser2.Document.GetElementById("go_lastpage").Focus()
                WebBrowser2.Document.All("textarea").InnerText = "新春快乐,马年吉祥" & Int(100 * Rnd()).ToString
                WebBrowser2.Document.All("Submit").InvokeMember("click")

                iCountSend += 1
                TextBox2.Text = iCountSend
                If iCountSend = 1 Then
                    Timer2.Enabled = True
                Else
                    blnSend = False
                    Timer2.Enabled = False

                    blnCheck = True
                    iCountSend = 0
                    Timer1.Enabled = True

                    TextBox1.Text = ""
                End If
            End If
            End If
    End Sub

    Private Sub Button1_Click(sender As Object,e As EventArgs) Handles Button1.Click
        blnCheck = True
        Timer1.Enabled = Enabled
    End Sub

    Private Sub Form1_Load(sender As Object,e As EventArgs) Handles MyBase.Load
        Randomize()
        WebBrowser1.ScrollBarsEnabled = True
        WebBrowser1.ScriptErroRSSuppressed = True
        WebBrowser1.Navigate("http://www.myboyan.com/yule/") '为了登录


        WebBrowser2.ScrollBarsEnabled = True
        WebBrowser2.ScriptErroRSSuppressed = True
    End Sub

End Class

猜你在找的VB相关文章