然后
Private Sub Form_Load()
WebBrowser1.Navigate2 "d:\1.htm"
End Sub
Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
On Error Resume Next
Dim oDoc As HTMLDocument
Set oDoc = pDisp.document
Dim oForm As HTMLFormElement
Set oForm = oDoc.Forms("login1")
If Not oForm Is Nothing Then
oForm.submit
End If
End Sub
谢谢你们的回答!
可能是我说的不是很清楚,我是想在VB里调用IE打开我所需的页面.并且要POST传参数实现.
GET传参数我已经实现了,如下所示:
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Sub Command1_Click()
Dim ret&
ret& = ShellExecute(Me.hwnd, "Open", "http://192.168.0.1/login.asp?username=admin&userpass=123", "", App.Path, 1)
End Sub