2017-06-07 15 views
0

こんにちは、トラフィックを生成するための新しいアプリケーションを開始し、私は3つのリストボックスを紹介リンク用に1つ、プロキシ用に1つ、ユーザエージェント用に1つずつ持っています。 私の質問は私のフォームにツリータイマーを追加して、テキストボックスの参照リンクを10秒ごとに変更する必要があります。 どうすればアーカイブできますか? これは私のコードですリストボックスの次のプロキシをタイマーvb.netで選択しました

Imports System.Runtime.InteropServices 
Imports System.Net 
Imports System 
Public Class Form3 
Dim FILE_NAME As String = "C:\proxy.txt" 
Dim x As Integer 
Dim rfe As Integer 
Dim prx As Integer 
Dim users As Integer 
Dim label As String 
Public proxy(2000) As String 
Public index As Integer = 0 
Public max_proxys As Integer = 0 
Dim a As String 
Dim start_check As Integer = 0 
<Runtime.InteropServices.DllImport("wininet.dll", SetLastError:=True)> _ 
Private Shared Function InternetSetOption(ByVal hInternet As IntPtr, ByVal dwOption As Integer, ByVal lpBuffer As IntPtr, ByVal lpdwBufferLength As Integer) As Boolean 
End Function 
Public Structure Struct_INTERNET_PROXY_INFO 
    Public dwAccessType As Integer 
    Public proxy As IntPtr 
    Public proxyBypass As IntPtr 
End Structure 
Private Sub UseProxy(ByVal strProxy As String) 
    Const INTERNET_OPTION_PROXY As Integer = 38 
    Const INTERNET_OPEN_TYPE_PROXY As Integer = 3 

    Dim struct_IPI As Struct_INTERNET_PROXY_INFO 

    struct_IPI.dwAccessType = INTERNET_OPEN_TYPE_PROXY 
    struct_IPI.proxy = Marshal.StringToHGlobalAnsi(strProxy) 
    struct_IPI.proxyBypass = Marshal.StringToHGlobalAnsi("local") 

    Dim intptrStruct As IntPtr = Marshal.AllocCoTaskMem(Marshal.SizeOf(struct_IPI)) 

    Marshal.StructureToPtr(struct_IPI, intptrStruct, True) 

    Dim iReturn As Boolean = InternetSetOption(IntPtr.Zero, INTERNET_OPTION_PROXY, intptrStruct, System.Runtime.InteropServices.Marshal.SizeOf(struct_IPI)) 
End Sub 

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click 
    Timer1.Enabled = True 

End Sub 

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click 
    Timerreferrals.Enabled = True 
    UseProxy(Label8.Text) 
    Dim wr As HttpWebRequest = HttpWebRequest.Create(TextBox1.Text) 
    wr.Referer = TextBox5.Text 
    wr.UserAgent = "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36" 
    Dim resp As HttpWebResponse = wr.GetResponse 
    WebBrowser1.Navigate(TextBox1.Text) 
    Button1.Enabled = False 
    Button2.Enabled = True 
    Button3.Enabled = True 
End Sub 

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click 
    Timer1.Enabled = False 
    Button1.Enabled = True 
    Button2.Enabled = False 
    Button3.Enabled = False 
End Sub 

Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick 

    x = x + 1 
    If x = TextBox2.Text Then 
     WebBrowser1.Refresh() 
     x = 0 
     Label4.Text = Val(Label4.Text) + 1 

    End If 
End Sub 

Private Sub Form3_Load(sender As Object, e As EventArgs) Handles MyBase.Load 
    TextBox2.Text = 10 
End Sub 

Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click 
    Label8.Text = (TextBox3.Text & ":" & TextBox4.Text) 
End Sub 

Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click 
    If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then 


     Dim path As String = OpenFileDialog1.FileName 

     ListBox1.Items.AddRange(System.IO.File.ReadAllLines(path)) 

    End If 

End Sub 

Private Sub Label13_Click(sender As Object, e As EventArgs) Handles Label13.Click 
    ListBox1.Items.Clear() 

End Sub 

Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click 
    If OpenFileDialog2.ShowDialog = Windows.Forms.DialogResult.OK Then 


     Dim path As String = OpenFileDialog2.FileName 

     ListBox2.Items.AddRange(System.IO.File.ReadAllLines(path)) 

    End If 
End Sub 

Private Sub Label14_Click(sender As Object, e As EventArgs) Handles Label14.Click 
    ListBox2.Items.Clear() 

End Sub 

Private Sub Label15_Click(sender As Object, e As EventArgs) Handles Label15.Click 
    ListBox4.Items.Clear() 

End Sub 

Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click 
    If OpenFileDialog3.ShowDialog = Windows.Forms.DialogResult.OK Then 


     Dim path As String = OpenFileDialog3.FileName 

     ListBox4.Items.AddRange(System.IO.File.ReadAllLines(path)) 

    End If 
End Sub 

Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timerreferrals.Tick 
    rfe = rfe + 1 
    Dim counthit = 0 
    TextBox5.Text = ListBox1.Text 
    Label17.Text = rfe 
    Timerreferrals.Interval = 1000 
    Dim sb As New System.Text.StringBuilder() 
    If rfe = TextBox6.Text Then 
     For Each o As Object In ListBox1.Items 
      'sb.AppendLine(o) 
      'TextBox5.Text = sb.ToString 
      ' rfe = 0 
      counthit = counthit + 1 

     Next 
     ListBox1.SelectedIndex = Me.ListBox1.SelectedIndex + 1 


     TextBox5.Text = ListBox1.Text 
     rfe = 0 
    End If 




    If TextBox6.Text = "" Then 
     Return 

    End If 


End Sub 
End Class 
+0

私はこのような試みたがListBox1.Itemsに文字列として各行 TextBox5.Text =ライン 次 –

+0

のための成功事例の誰も助けることができる可能性が高いではありませんあなたはこれらのコントロールのレイアウトとその中にある値の**説明**を示す何らかの種類のスクリーンショットがありません。 –

+0

申し訳ありませんが、それはアプリからの印刷物であり、その仕組みhttp://imgur.com/a/4kXKL –

答えて

0

私の質問私は 変化にタイマーリストボックスから現在の項目をその仕上げをするたびに取得するために管理する必要がありですが、温首相は、そのエラーを作り、最終的な アイテムを来ります範囲外の...どのように私はそう変更... WENは これ以上の項目があります検出し、再び

ガッチャ最初に行くことができます:

ListBox1.SelectedIndex = Me.ListBox1.SelectedIndex + 1 
以下のような何かに

If Me.ListBox1.SelectedIndex < Me.ListBox1.Items.Count - 1 Then 
    Me.ListBox1.SelectedIndex = Me.ListBox1.SelectedIndex + 1 
Else 
    Me.ListBox1.SelectedIndex = 0 
End If 
+0

タンクあなたは私の皮膚を救っている可能ですが、私はタンクがその仕事を完璧にするのを忘れました@Idle_Mind –

関連する問題