Option Explicit
Dim URL1 As String
Dim x As ObjectDim lngRetVal As LongPrivate Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
'加2个webbrowser控件web1,web2,一个command1,一个picture1
Private Sub Form_Load()
URL1 = "http://reg.163.com/reg/reg0.jsp?url=http://mscan.163.com/activate163/QuickCreateMail.jsp"
Web1.Navigate2 URL1
End Sub
Private Sub Command1_Click()
For Each x In Web1.Document.All
If x163.tagname = "IMG" Then
If x.Id = "randomNoImg" Then
lngRetVal = URLDownloadToFile(0, x163.src, App.Path & "\1.jpg", 0, 0)
Picture1.Picture = LoadPicture(App.Path & "\1.jpg")
Web2.Navigate2 x.src
Exit For
End If
End If
NextEnd Sub这样的话,那个picture1和和web2控件显示的图片,和那个web1的不同,怎么办?请教请教!
Dim URL1 As String
Dim x As ObjectDim lngRetVal As LongPrivate Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
'加2个webbrowser控件web1,web2,一个command1,一个picture1
Private Sub Form_Load()
URL1 = "http://reg.163.com/reg/reg0.jsp?url=http://mscan.163.com/activate163/QuickCreateMail.jsp"
Web1.Navigate2 URL1
End Sub
Private Sub Command1_Click()
For Each x In Web1.Document.All
If x163.tagname = "IMG" Then
If x.Id = "randomNoImg" Then
lngRetVal = URLDownloadToFile(0, x163.src, App.Path & "\1.jpg", 0, 0)
Picture1.Picture = LoadPicture(App.Path & "\1.jpg")
Web2.Navigate2 x.src
Exit For
End If
End If
NextEnd Sub这样的话,那个picture1和和web2控件显示的图片,和那个web1的不同,怎么办?请教请教!
请问:
Dim x, CtrlRange '这样就行,但是定义成Dim x As Object,CtrlRange As Object就不下载不到图(2.bmp不出现),不知为什么?