0

如何通过 Visual Basic 6 Webbrowser 控件在 PHP 表单中填写 FileSelection?我想发送一个文件上传到网站上,我必须手动更改页面中的文件,有没有办法解决这个问题?

4

1 回答 1

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

我以前从来没有玩过这个,所以可能有很多可以改进的地方。例如,其中的变量类型retValVariantnow。

于 2013-03-25T09:47:48.337 回答