如何通过Visual Basic 6 Webbrowser控件在PHP表单中填写FileSelection? 我想发送一个文件在网站上传,我必须在页面中更改文件,如manualy, 有什么方法可以解决这个问题吗?
答案 0 :(得分:0)
我创建了一个简单的示例项目,似乎可以做你想要的。
'1 form with :
' 1 webbrowser control : name=WebBrowser1
' 1 command button : name=Command1
Option Explicit
Private Sub Command1_Click()
WebBrowser1.Navigate "www.dailygammon.com/bg/login"
End Sub
Private Sub Form_Resize()
Dim sngWidth As Single, sngHeight As Single
Dim sngCmdHeight As Single
sngCmdHeight = 315
sngWidth = ScaleWidth
sngHeight = ScaleHeight - sngCmdHeight
WebBrowser1.Move 0, 0, sngWidth, sngHeight
Command1.Move 0, sngHeight, sngWidth, sngCmdHeight
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim strName As String
Dim retVal
strName = "your name"
retVal = WebBrowser1.Document.GetElementsByName("login")
retVal.Value = strName
End Sub
我之前从未玩过这个,所以可能有一些东西可以改进。例如,retVal
的变量类型现在为Variant
。