Private Sub webSky_DownloadComplete()
On Error Resume Next
WebSky.Silent = True
Me.MousePointer = vbDefault
Dim x, CtrlRange
Dim sPath As String
sPath = App.Path
sPath = Left(sPath, InStr(sPath, vbNullChar) - 1)
If Len(sPath) > 3 Then sPath = sPath & "\"
If Trim(txtUser.Text) <> "" Then
gstrFileName = sPath & Trim(txtUser.Text) & "Code.bmp"
Else
gstrFileName = sPath & "TempCode.bmp"
End If
For Each x In WebSky.Document.All
If x.tagName = "IMG" Then
If x.src = "http://getCode.asp" Then '这里就是那个动态图片的连接了
WebSky.Stop
Set CtrlRange = WebSky.Document.body.createControlRange()
CtrlRange.Add (x)
CtrlRange.execCommand ("Copy")
Private 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
Private Sub saveimage(URL As String, ByVal index As Integer)
Dim tempfile As String
tempfile = "C:\code" & index & ".bmp"
URLDownloadToFile 0, URL, tempfile, 0, 0
End Sub
Private Sub Command1_Click()
Dim i As Integer
For i = 1 To 20
saveimage "http://db.sohu.com/regurl/code.asp", i
Next
MsgBox "ok"
End Sub
'Add a picturebox and a commandbutton,then click the commandbutton many times.
Private 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
Private Sub showimage(URL As String)
Dim tempfile As String
tempfile = "C:\" & Mid(URL, InStrRev(URL, "/") + 1)
URLDownloadToFile 0, URL, tempfile, 0, 0
Picture1.Picture = LoadPicture(tempfile)
End Sub
Private Sub Command1_Click()
showimage "http://db.sohu.com/regurl/code.asp"
End Sub