[转贴]一个比较那个的代码!

      发到这儿来主要是原先的发布格式太乱,看起来不方便
      来源那个网页上也没有,作者看到本页面,可以和我联系,我加上你的大名。
      对了,代码是AxWebBrowser应用的完整例子,用于自动提交网页表单
None.gif Option   Explicit   On  
None.gif
Imports  mshtml
None.gif
Imports  System.DateTime
None.gif
Imports  Microsoft.VisualBasic
ExpandedBlockStart.gifContractedBlock.gif
Public   Class form1 Class form1
InBlock.gif
Inherits System.Windows.Forms.Form
ContractedSubBlock.gifExpandedSubBlockStart.gif
Windows 窗体设计器生成的代码#Region " Windows 窗体设计器生成的代码 "
ExpandedSubBlockStart.gifContractedSubBlock.gif
Public Sub New()Sub New()
InBlock.gif
MyBase.New()
InBlock.gif
InBlock.gif
'该调用是 Windows 窗体设计器所必需的。
InBlock.gif
InitializeComponent()
InBlock.gif
'在 InitializeComponent() 调用之后添加任何初始化
InBlock.gif'
brow.Navigate("http://www.netsh.com")
InBlock.gif'
brow.Navigate("h:\softuyou.htm")
InBlock.gif'
brow.Navigate("http://goal28.ziqu.com/bbs/250006/")
InBlock.gif'
brow.Navigate("http://www.netsh.net/subdomains/f_s_o.php?p=0&leibie=wenxue")
InBlock.gif'
brow.Navigate("http://my.clubhi.com/bbs/661134/")
InBlock.gif

InBlock.gif
Randomize()
ExpandedSubBlockEnd.gif
End Sub

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

InBlock.gif
'Windows 窗体设计器所必需的
InBlock.gif
Private components As System.ComponentModel.IContainer
InBlock.gif
'注意: 以下过程是 Windows 窗体设计器所必需的
InBlock.gif'
可以使用 Windows 窗体设计器修改此过程。
InBlock.gif'
不要使用代码编辑器修改它。
InBlock.gif
Friend WithEvents txtAddress As System.Windows.Forms.TextBox
InBlock.gif
Friend WithEvents brow As AxSHDocVw.AxWebBrowser
InBlock.gif
Friend WithEvents lblStatus As System.Windows.Forms.Label
InBlock.gif
Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
InBlock.gif
Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
InBlock.gif
Friend WithEvents mnuFill As System.Windows.Forms.MenuItem
InBlock.gif
Friend WithEvents mnuNetsh As System.Windows.Forms.MenuItem
InBlock.gif
Friend WithEvents lst1Url As System.Windows.Forms.ListBox
InBlock.gif
Friend WithEvents mnuTest As System.Windows.Forms.MenuItem
ExpandedSubBlockStart.gifContractedSubBlock.gif
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()Sub InitializeComponent()
InBlock.gif
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(form1))
InBlock.gif
Me.txtAddress = New System.Windows.Forms.TextBox
InBlock.gif
Me.lblStatus = New System.Windows.Forms.Label
InBlock.gif
Me.brow = New AxSHDocVw.AxWebBrowser
InBlock.gif
Me.MainMenu1 = New System.Windows.Forms.MainMenu
InBlock.gif
Me.MenuItem1 = New System.Windows.Forms.MenuItem
InBlock.gif
Me.mnuFill = New System.Windows.Forms.MenuItem
InBlock.gif
Me.mnuNetsh = New System.Windows.Forms.MenuItem
InBlock.gif
Me.mnuTest = New System.Windows.Forms.MenuItem
InBlock.gif
Me.lst1Url = New System.Windows.Forms.ListBox
InBlock.gif
CType(Me.brow, System.ComponentModel.ISupportInitialize).BeginInit()
InBlock.gif
Me.SuspendLayout()
InBlock.gif
'
InBlock.gif'
txtAddress
InBlock.gif'
InBlock.gif
Me.txtAddress.Location = New System.Drawing.Point(1768)
InBlock.gif
Me.txtAddress.Name = "txtAddress"
InBlock.gif
Me.txtAddress.Size = New System.Drawing.Size(56821)
InBlock.gif
Me.txtAddress.TabIndex = 0
InBlock.gif
Me.txtAddress.Text = ""
InBlock.gif
'
InBlock.gif'
lblStatus
InBlock.gif'
InBlock.gif
Me.lblStatus.Location = New System.Drawing.Point(88)
InBlock.gif
Me.lblStatus.Name = "lblStatus"
InBlock.gif
Me.lblStatus.Size = New System.Drawing.Size(16016)
InBlock.gif
Me.lblStatus.TabIndex = 1
InBlock.gif
Me.lblStatus.Text = "Status"
InBlock.gif
'
InBlock.gif'
brow
InBlock.gif'
InBlock.gif
Me.brow.Enabled = True
InBlock.gif
Me.brow.Location = New System.Drawing.Point(832)
InBlock.gif
Me.brow.OcxState = CType(resources.GetObject("brow.OcxState"), System.Windows.Forms.AxHost.State)
InBlock.gif
Me.brow.Size = New System.Drawing.Size(344520)
InBlock.gif
Me.brow.TabIndex = 2
InBlock.gif
'
InBlock.gif'
MainMenu1
InBlock.gif'
InBlock.gif
Me.MainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem1, Me.mnuFill, Me.mnuNetsh, Me.mnuTest})
InBlock.gif
'
InBlock.gif'
MenuItem1
InBlock.gif'
InBlock.gif
Me.MenuItem1.Index = 0
InBlock.gif
Me.MenuItem1.Text = "&File"
InBlock.gif
'
InBlock.gif'
mnuFill
InBlock.gif'
InBlock.gif
Me.mnuFill.Index = 1
InBlock.gif
Me.mnuFill.Text = "Fi&ll"
InBlock.gif
'
InBlock.gif'
mnuNetsh
InBlock.gif'
InBlock.gif
Me.mnuNetsh.Index = 2
InBlock.gif
Me.mnuNetsh.Text = "&Netsh"
InBlock.gif
'
InBlock.gif'
mnuTest
InBlock.gif'
InBlock.gif
Me.mnuTest.Index = 3
InBlock.gif
Me.mnuTest.Text = "&Test"
InBlock.gif
'
InBlock.gif'
lst1Url
InBlock.gif'
InBlock.gif
Me.lst1Url.ItemHeight = 12
InBlock.gif
Me.lst1Url.Location = New System.Drawing.Point(35232)
InBlock.gif
Me.lst1Url.MultiColumn = True
InBlock.gif
Me.lst1Url.Name = "lst1Url"
InBlock.gif
Me.lst1Url.Size = New System.Drawing.Size(432520)
InBlock.gif
Me.lst1Url.Sorted = True
InBlock.gif
Me.lst1Url.TabIndex = 3
InBlock.gif
'
InBlock.gif'
form1
InBlock.gif'
InBlock.gif
Me.AutoScaleBaseSize = New System.Drawing.Size(614)
InBlock.gif
Me.AutoScroll = True
InBlock.gif
Me.ClientSize = New System.Drawing.Size(792557)
InBlock.gif
Me.Controls.Add(Me.lst1Url)
InBlock.gif
Me.Controls.Add(Me.brow)
InBlock.gif
Me.Controls.Add(Me.lblStatus)
InBlock.gif
Me.Controls.Add(Me.txtAddress)
InBlock.gif
Me.Menu = Me.MainMenu1
InBlock.gif
Me.Name = "form1"
InBlock.gif
Me.Text = "浏览器(tuenhai)"
InBlock.gif
Me.WindowState = System.Windows.Forms.FormWindowState.Maximized
InBlock.gif
CType(Me.brow, System.ComponentModel.ISupportInitialize).EndInit()
InBlock.gif
Me.ResumeLayout(False)
ExpandedSubBlockEnd.gif
End Sub

ExpandedSubBlockEnd.gif
#End Region

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif
netsh 注册和发言整体程序#Region "netsh 注册和发言整体程序"
ExpandedSubBlockStart.gifContractedSubBlock.gif
Private Sub mnuNetsh_Click()Sub mnuNetsh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuNetsh.Click
InBlock.gif
On Error Resume Next
InBlock.gifbrow.Navigate(
"http://www.netsh.com/"'打开首页
InBlock.gif
Do While brow.Busy
InBlock.gifApplication.DoEvents()
InBlock.gif
Loop
InBlock.gifSearchKey 
= "leibie=" '重定义关键词为类别(leibie=)
InBlock.gif
Call getUrls() '搜集分类网址到列表框
InBlock.gif
Delay(FromOADate(delayT * 3)) '延时1秒
InBlock.gif'
MsgBox(lst1Url.Items.Count, MsgBoxStyle.DefaultButton3, "lst1ur1的论坛数")
InBlock.gif'
Threading.Thread.CurrentThread.Sleep(1000)
InBlock.gif
Dim countLstNetsh As Short
InBlock.gif
Dim LstNetsh As New ListBox '新建一ListBox
InBlock.gif
LstNetsh.Items.AddRange(lst1Url.Items) '复制list1到lstNetsh
InBlock.gif
lst1Url.Items.Clear()
InBlock.gif
For countLstNetsh = 0 To LstNetsh.Items.Count - 1
InBlock.gif
If brow.LocationURL <> LstNetsh.Items(countLstNetsh) Then
InBlock.gifbrow.Navigate(LstNetsh.Items(countLstNetsh)) 
'导航到lstNetsh中的第一个地址
InBlock.gif
End If
InBlock.gif
'Delay(FromOADate(delayT / 5)) '延时1秒
InBlock.gif
Do While brow.Busy
InBlock.gifApplication.DoEvents()
InBlock.gif
Loop
InBlock.gif
'Threading.Thread.CurrentThread.Sleep(1000)
InBlock.gif'
Delay(FromOADate(delayT * 3))
InBlock.gif'
MsgBox(brow.LocationURL)
InBlock.gif'
**********************以下得到编程栏的网址类别目录列表***************
InBlock.gif
Dim instrLeibie As Short
InBlock.gif
Dim LocUrl As String = LstNetsh.Items(countLstNetsh)
InBlock.gifinstrLeibie 
= InStr(LocUrl, SearchKey, CompareMethod.Text)
InBlock.gifSearchKey 
= Strings.Right(LocUrl, Len(LstNetsh.Items(countLstNetsh)) - instrLeibie + 1'得到搜索关键词leibie=biancheng
InBlock.gif
MsgBox(SearchKey, MsgBoxStyle.DefaultButton1, "newsearchkey")
InBlock.giflst1Url.Items.Clear() 
'先清空列表框
InBlock.gif
Call getUrls() '搜索包含leibie=biancheng的网址
InBlock.gif
Delay(FromOADate(delayT * 3)) '延时1秒
InBlock.gif'
Threading.Thread.CurrentThread.Sleep(1000)
InBlock.gif
lst1Url.Items.Add(brow.LocationURL) '再加上当前网址
InBlock.gif
Dim LstBianCheng As New ListBox '编程目录
InBlock.gif
LstBianCheng.Items.AddRange(lst1Url.Items) '把lst1Url中的网址传到LstBiancheng
InBlock.gif
lst1Url.Items.Clear() '清空lst1Url
InBlock.gif'
**************************导航到biacheng目录中的第1页,并得到论坛网址目录
InBlock.gif
Dim countLstBianCheng As Short
InBlock.gif
For countLstBianCheng = 0 To LstBianCheng.Items.Count - 1 '编程目录的页数
InBlock.gif
If brow.LocationURL <> LstBianCheng.Items(countLstBianCheng) Then
InBlock.gifbrow.Navigate(LstBianCheng.Items(countLstBianCheng)) 
'导航到编程目录的第一页
InBlock.gif
End If
InBlock.gif
' Delay(FromOADate(delayT / 5)) '延时1秒
InBlock.gif
Do While brow.Busy
InBlock.gifApplication.DoEvents()
InBlock.gif
Loop
InBlock.gif
'Threading.Thread.CurrentThread.Sleep(1000)
InBlock.gif'
Delay(FromOADate(delayT * 3))
InBlock.gif
Call GetForms()
InBlock.gifDelay(FromOADate(delayT 
* 3)) '延时1秒
InBlock.gif'
Threading.Thread.CurrentThread.Sleep(1000)
InBlock.gif
Dim LstBianChengUrl As New ListBox '编程目录第1页的论坛列表
InBlock.gif
LstBianChengUrl.Items.AddRange(lst1Url.Items)
InBlock.giflst1Url.Items.Clear()
InBlock.gif
Dim countLstBianchUrl As Short
InBlock.gif
For countLstBianchUrl = 0 To LstBianChengUrl.Items.Count - 1
InBlock.gifbrow.Navigate(LstBianChengUrl.Items(countLstBianchUrl))
InBlock.gif
'Delay(FromOADate(delayT / 5)) '延时1秒
InBlock.gif'
Threading.Thread.CurrentThread.Sleep(1000)
InBlock.gif
Do While brow.Busy
InBlock.gifApplication.DoEvents()
InBlock.gif
Loop
InBlock.gifDelay(FromOADate(delayT 
* 3))
InBlock.gif
'MsgBox(brow.Document.all.tags("html").item(0).outerhtml, MsgBoxStyle.DefaultButton3, _
InBlock.gif'
 "看看打开的论坛源代码中有没有FRAMESET,有就执行下面代码")
InBlock.gif

InBlock.gif
If InStr(brow.Document.all.tags("html").item(0).outerhtml, "FRAMESET"Then
InBlock.gif
If InStr(brow.Document.frames(0).document.body.innerhtml, "发表新帖子"Then '如果网页中有"发表新帖子"就执行
InBlock.gif
Dim bcUrl As String = LstBianChengUrl.Items(countLstBianchUrl)
InBlock.gif
MsgBox(bcUrl, MsgBoxStyle.DefaultButton3, "LstBianChengUrl.Items(countLstBianchUrl)")
InBlock.gif
Dim bookNum As String = Strings.Right(bcUrl, Len(bcUrl) - InStrRev(bcUrl, "/"-1, CompareMethod.Text))
InBlock.gif
MsgBox(bookNum)
InBlock.gif
Dim UrlAdd As String = Strings.Left(bcUrl, InStr(8, bcUrl, "/", CompareMethod.Text)) & "fcgi-bin/addboard.fcgi?bookname=" & bookNum
InBlock.gifbrow.Navigate(UrlAdd)
InBlock.gif
'Delay(FromOADate(delayT / 5))
InBlock.gif
Do While brow.Busy
InBlock.gifApplication.DoEvents()
InBlock.gif
Loop
InBlock.gif
'Threading.Thread.CurrentThread.Sleep(1000)
InBlock.gif'
Delay(FromOADate(delayT * 3))
InBlock.gif'
MsgBox(UrlAdd, MsgBoxStyle.DefaultButton3, "urladd")
InBlock.gif'
MsgBox(brow.Document.body.innertext, MsgBoxStyle.DefaultButton2, "body中有没有第一次发言请注册")
InBlock.gif
If InStr(brow.Document.body.innertext, "第一次发言请注册"Then '如果要求注册
InBlock.gif
Dim urlSign As String = Strings.Left(bcUrl, InStr(8, bcUrl, "/", CompareMethod.Text)) & "cgi-bin/signup.cgi?bookname=" & bookNum
InBlock.gifbrow.Navigate(urlSign)
InBlock.gif
'Delay(FromOADate(delayT / 5))
InBlock.gif'
MsgBox(urlSign, MsgBoxStyle.DefaultButton1, "urlsign")
InBlock.gif
Do While brow.Busy
InBlock.gifApplication.DoEvents()
InBlock.gif
Loop
InBlock.gif
'Threading.Thread.CurrentThread.Sleep(1000)
InBlock.gif'
Delay(FromOADate(delayT * 3))
InBlock.gif
Call mnufill_Click(sender, e) '呼叫注册程序
InBlock.gif
Delay(FromOADate(delayT * 3))
InBlock.gif
Do While brow.Busy
InBlock.gifApplication.DoEvents()
InBlock.gif
Loop
InBlock.gif
'Threading.Thread.CurrentThread.Sleep(1000)
InBlock.gif
brow.Navigate(UrlAdd)
InBlock.gif
Do While brow.Busy
InBlock.gifApplication.DoEvents()
InBlock.gif
Loop
InBlock.gif
'Threading.Thread.CurrentThread.Sleep(1000)
InBlock.gif'
Delay(FromOADate(delayT * 3))
InBlock.gif
Call mnufill_Click(sender, e) '发表新帖子
InBlock.gif
Delay(FromOADate(delayT * 3))
InBlock.gif
Do While brow.Busy
InBlock.gifApplication.DoEvents()
InBlock.gif
Loop
InBlock.gif
'Threading.Thread.CurrentThread.Sleep(1000)
InBlock.gif
Else
InBlock.gif
Call mnufill_Click(sender, e)
InBlock.gif
Do While brow.Busy
InBlock.gifApplication.DoEvents()
InBlock.gif
Loop
InBlock.gif
'Threading.Thread.CurrentThread.Sleep(1000)
InBlock.gif'
Delay(FromOADate(delayT * 3))
InBlock.gif
End If
InBlock.gif
End If
InBlock.gif
End If
InBlock.gif
Next countLstBianchUrl
InBlock.gif
Exit For
InBlock.gif
Next countLstBianCheng
InBlock.gif
Exit For
InBlock.gif
Next countLstNetsh
ExpandedSubBlockEnd.gif
End Sub

ExpandedSubBlockEnd.gif
#End Region

ContractedSubBlock.gifExpandedSubBlockStart.gif
netsh注册和发言#Region "netsh注册和发言"
ExpandedSubBlockStart.gifContractedSubBlock.gif
Private Sub mnufill_Click()Sub mnufill_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFill.Click
InBlock.gif
On Error Resume Next
InBlock.gif
Do While brow.Busy
InBlock.gifApplication.DoEvents()
InBlock.gif
Loop
InBlock.gif
Dim cardNum As Integer = Int((9999 * Rnd()) + 1000)
InBlock.gif
Dim countTag As Short
InBlock.gif
Dim webDoc As Object = brow.Document.all
InBlock.gif
Dim webTag As Object
InBlock.gif
Dim lengthTag As Short = webDoc.length - 1
InBlock.giflst1Url.Items.Clear()
InBlock.gif
For countTag = 0 To lengthTag
InBlock.gif
If InStr(brow.LocationURL, "signup.cgi?bookname"Then '如果网址中包含signup,就执行下面代码
InBlock.gif
If UCase(webDoc.item(countTag).tagname) = "IMG" Then '如果找到img标签,就写值
InBlock.gif
webDoc.Item(countTag).src = "http://www.netsh.net/subdomains/put_img.php?str=492972"
InBlock.gif
End If
InBlock.gif
End If
InBlock.gif
If LCase(webDoc.item(countTag).tagname) = "input" Or LCase(webDoc.item(countTag).tagname) = "textarea" Then '找到input或textarea标签
InBlock.gif
webTag = webDoc.item(countTag)
InBlock.gif
If Not webDoc("str"Is Nothing Then
InBlock.gifwebDoc(
"str").value = strStr '重写name为str的网页元素值
InBlock.gif
End If
InBlock.gif
If LCase(webTag.type) = "text" Or LCase(webTag.type) = "password" Then '找到text或password标签
InBlock.gif
Select Case webTag.name
InBlock.gif
Case "name""userid" '用户名
InBlock.gif
webTag.value = strName
InBlock.gif
Case "passwd""password""confirm" '密码,确认密码
InBlock.gif
webTag.value = strPass '
InBlock.gif
Case "subject" '标题
InBlock.gif
webTag.value = strSubject & cardNum
InBlock.gif
Case "regid" '注册码
InBlock.gif
webTag.value = strRegid
InBlock.gif
Case "username"
InBlock.gifwebTag.value 
= GetRndChar(62'真实姓名
InBlock.gif
Case "cardnumber"
InBlock.gifwebTag.value 
= strCardNumber & cardNum '证件号
InBlock.gif
Case "homephone"
InBlock.gifwebTag.value 
= strHomephone '电话号
InBlock.gif
End Select
InBlock.gif
ElseIf webTag.name = "body" Then
InBlock.gifwebTag.value 
= strBody
InBlock.gif
End If
InBlock.gif
End If
InBlock.gif
Next
InBlock.gifbrow.Document.forms(
0).submit()
InBlock.gif
ExpandedSubBlockEnd.gif
End Sub

ExpandedSubBlockEnd.gif
#End Region

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif
以SearchKey为关键词得到网址#Region "以SearchKey为关键词得到网址"
ExpandedSubBlockStart.gifContractedSubBlock.gif
Private Sub getUrls()Sub getUrls()
InBlock.gif
On Error Resume Next
InBlock.gif
Do While brow.Busy
InBlock.gifApplication.DoEvents()
InBlock.gif
Loop
InBlock.gif
Dim countTag As Short
InBlock.gif
Dim webDoc As Object = brow.Document.all
InBlock.gif
Dim webTag As Object
InBlock.gif
Dim lengthTag As Short = webDoc.length - 1
InBlock.gif
For countTag = 0 To lengthTag
InBlock.gif
If LCase(webDoc.item(countTag).tagname) = "a" Then
InBlock.gifwebTag 
= webDoc.item(countTag).href
InBlock.gif
If InStr(webTag, SearchKey) Then
InBlock.giflst1Url.Items.Add(webTag)
InBlock.gif
End If
InBlock.gif
End If
InBlock.gif
Next countTag '以上代码得到网址列表
InBlock.gif
Dim CountLst1 As Short '以下代码去除重复地址
InBlock.gif
Dim Lst2Url() As String
InBlock.gif
Dim UBoundLst2 As Short
InBlock.gif
With lst1Url
InBlock.gif
ReDim Preserve Lst2Url(0)
InBlock.gifLst2Url(
0= .Items(0'新数组的第一项和list的第一项相同
InBlock.gif
For CountLst1 = 1 To .Items.Count - 1 'items.count得到list1中的项目数
InBlock.gif
UBoundLst2 = UBound(Lst2Url) 'curid为newlist中有项目数
InBlock.gif
If .Items(CountLst1) <> Lst2Url(UBoundLst2) Then '如果旧表第二项不等于新表第一项
InBlock.gif
ReDim Preserve Lst2Url(UBoundLst2 + 1'定位到新表第二项
InBlock.gif
Lst2Url(UBoundLst2 + 1= .Items(CountLst1) '新表第二项等于旧表第二项
InBlock.gif
End If
InBlock.gif
Next CountLst1
InBlock.gif.Items.Clear() 
'删除旧表所有项
InBlock.gif
For CountLst1 = 0 To UBound(Lst2Url) '把新表写入旧表
InBlock.gif
.Items.Add(Lst2Url(CountLst1))
InBlock.gif
Next CountLst1
InBlock.gif
End With
ExpandedSubBlockEnd.gif
End Sub

ExpandedSubBlockEnd.gif
#End Region

ContractedSubBlock.gifExpandedSubBlockStart.gif
得到netsh网页中的论坛网址,并加入到lst1Url#Region "得到netsh网页中的论坛网址,并加入到lst1Url"
ExpandedSubBlockStart.gifContractedSubBlock.gif
Private Sub GetForms()Sub GetForms()
InBlock.gif
On Error Resume Next
InBlock.gif
Do While brow.Busy
InBlock.gifApplication.DoEvents()
InBlock.gif
Loop
InBlock.gif
Dim countTag As Short
InBlock.gif
Dim webDoc As Object = brow.Document.all
InBlock.gif
Dim webTag As Object
InBlock.gif
Dim lengthTag As Short = webDoc.length - 1
InBlock.giflst1Url.Items.Clear()
InBlock.gif
For countTag = 0 To lengthTag
InBlock.gif
If LCase(webDoc.item(countTag).tagname) = "a" Then '得到网址
InBlock.gif
webTag = webDoc.item(countTag).href
InBlock.gif
If InStr("1234567890", Strings.Right(webTag, 1)) Then '只选取末位是数字的网址
InBlock.gif
lst1Url.Items.Add(webTag)
InBlock.gif
End If
InBlock.gif
End If
InBlock.gif
Next countTag '以上代码得到网址列表
InBlock.gif
Dim countForms As Short '以下代码去除重复地址
InBlock.gif
Dim lstForms() As String
InBlock.gif
Dim CurId As Short
InBlock.gif
With lst1Url
InBlock.gif
ReDim Preserve lstForms(0)
InBlock.giflstForms(
0= .Items(0'新数组的第一项和list的第一项相同
InBlock.gif
For countForms = 1 To .Items.Count - 1 'items.count得到list1中的项目数
InBlock.gif
CurId = UBound(lstForms) 'curid为newlist中有项目数
InBlock.gif
If .Items(countForms) <> lstForms(CurId) Then '如果旧表第二项不等于新表最大项
InBlock.gif
ReDim Preserve lstForms(CurId + 1'定位到新表第二项
InBlock.gif
lstForms(CurId + 1= .Items(countForms) '新表第二项等于旧表第二项
InBlock.gif
End If
InBlock.gif
Next countForms
InBlock.gif.Items.Clear() 
'删除旧表所有项
InBlock.gif
For countForms = 0 To UBound(lstForms) '把新表写入旧表
InBlock.gif
.Items.Add(lstForms(countForms))
InBlock.gif
Next countForms
InBlock.gif
End With
ExpandedSubBlockEnd.gif
End Sub

ExpandedSubBlockEnd.gif
#End Region

ContractedSubBlock.gifExpandedSubBlockStart.gif
保存相关信息到文本文件#Region "保存相关信息到文本文件"
ExpandedSubBlockStart.gifContractedSubBlock.gif
Private Sub SaveUser()Sub SaveUser()
InBlock.gif
Dim F As Integer
InBlock.gif
Dim FileName As String
InBlock.gif
Dim UserName As String = "testname"
InBlock.gif
Dim UserPassword As String = "testpass"
InBlock.gif
Dim strPath As String
InBlock.gifstrPath 
= Application.StartupPath
InBlock.gif
= FreeFile()
InBlock.gifFileName 
= strPath & "\user.txt"
InBlock.gif
FileOpen(F, FileName, OpenMode.Append)
InBlock.gif
PrintLine(F, DateTime.Now & vbCrLf & "netsh" & vbCrLf & "name=" & UserName)
InBlock.gif
'这里我们按emailclear的格式导出用户信息
InBlock.gif
FileClose(F)
ExpandedSubBlockEnd.gif
End Sub

ExpandedSubBlockEnd.gif
#End Region

ContractedSubBlock.gifExpandedSubBlockStart.gif
Delay函数#Region "Delay函数"
ExpandedSubBlockStart.gifContractedSubBlock.gif
Public Sub Delay()Sub Delay(ByRef HowLong As Date)
InBlock.gif
Dim temptime As Object
InBlock.giftemptime 
= DateAdd(DateInterval.Second, HowLong.ToOADate, Now)
InBlock.gif
While temptime > Now
InBlock.gifApplication.DoEvents()
InBlock.gif
End While
InBlock.gif
'System.Threading.Thread.CurrentThread.Sleep(1000)
ExpandedSubBlockEnd.gif
End Sub

ExpandedSubBlockEnd.gif
#End Region

ContractedSubBlock.gifExpandedSubBlockStart.gif
浏览器基本功能#Region " 浏览器基本功能"
ExpandedSubBlockStart.gifContractedSubBlock.gif
Private Sub brow_BeforeNavigate2()Sub brow_BeforeNavigate2(ByVal sender As ObjectByVal e As AxSHDocVw.DWebBrowserEvents2_BeforeNavigate2Event) Handles brow.BeforeNavigate2
InBlock.giftxtAddress.Text 
= e.uRL
ExpandedSubBlockEnd.gif
End Sub

ExpandedSubBlockStart.gifContractedSubBlock.gif
Private Sub txtAddress_KeyPress()Sub txtAddress_KeyPress(ByVal sender As ObjectByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtAddress.KeyPress
InBlock.gif
Dim KeyAscii As Short = Asc(e.KeyChar)
InBlock.gif
If KeyAscii = 13 Then
InBlock.gifbrow.Navigate((txtAddress.Text))
InBlock.gif
End If
InBlock.gif
If KeyAscii = 0 Then
InBlock.gife.Handled 
= True
InBlock.gif
End If
ExpandedSubBlockEnd.gif
End Sub

ExpandedSubBlockStart.gifContractedSubBlock.gif
Private Sub brow_StatusTextChange()Sub brow_StatusTextChange(ByVal sender As ObjectByVal e As AxSHDocVw.DWebBrowserEvents2_StatusTextChangeEvent) Handles brow.StatusTextChange
InBlock.giflblStatus.Text 
= e.text
ExpandedSubBlockEnd.gif
End Sub

ExpandedSubBlockStart.gifContractedSubBlock.gif
Private Sub brow_NewWindow2()Sub brow_NewWindow2(ByVal sender As ObjectByVal e As AxSHDocVw.DWebBrowserEvents2_NewWindow2Event) Handles brow.NewWindow2
InBlock.gife.ppDisp 
= brow.Application
InBlock.gife.cancel 
= True
ExpandedSubBlockEnd.gif
End Sub

ExpandedSubBlockEnd.gif
#End Region

ExpandedSubBlockStart.gifContractedSubBlock.gif
Private Sub mnuTest_Click()Sub mnuTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuTest.Click
InBlock.gif
' On Error Resume Next
ExpandedSubBlockEnd.gif
End Sub

ExpandedBlockEnd.gif
End Class

转载于:https://www.cnblogs.com/dhcn/archive/2006/07/04/442817.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值