我的源码是:
Private Sub Command1_Click()
cd1.Filter = "文本文件(.txt)|*.txt|DAT文件|*.dat"
cd1.FilterIndex = 1
cd1.ShowOpen
Dim filepath As String
filepath = cd1.FileName
Dim filenum As Integer
filenum = FreeFile
Dim info As String
Dim info2() As String
Dim i As Integer
If filepath <> "" Then
Open filepath For Input As #filenum
Do While Not EOF(filenum)
Line Input #filenum, info
List1.AddItem info
Loop
Close #filenum
End If
End Sub
Private Sub Command2_Click()
Dim n As Integer
Dim names As String
Dim pwd As String
If List1.ListCount = 0 Then
MsgBox ("还没加载用户名和密码")
Exit Sub
End If
For n = 0 To n = List1.ListCount - 1
names = Mid(List1.List(n), 1, InStr(List1.List(n), "/") - 1)
pwd = Mid(List1.List(n), InStr(List1.List(n), "/") + 1)
If WebBrowser1.LocationURL <> "http://passport.baidu.com/?login" Then
'检验是否为登录页
WebBrowser1.Navigate "http://passport.baidu.com/?login"
'msg ("autoland")
'Exit Sub
End If
Dim vDoc, vTag
Dim i As Integer
'自动填写这里下面是关键,你照抄就行
Set vDoc = WebBrowser1.Document
For i = 0 To vDoc.All.length - 1
If UCase(vDoc.All(i).tagName) = "INPUT" Then
Set vTag = vDoc.All(i)
If vTag.Type = "text" Or vTag.Type = "password" Then
Select Case vTag.Name
Case "username"
vTag.Value = names
Case "password"
vTag.Value = pwd
End Select
ElseIf vTag.Type = "submit" Then
vTag.Click
End If
End If
Next i
Next
End Sub
Private Sub Command3_Click()
List1.Clear
End Sub
Private Sub Form_Load()
WebBrowser1.Navigate "http://passport.baidu.com/?login"
End Sub