📄 form2.frm
字号:
VERSION 5.00
Begin VB.Form Form2
BorderStyle = 4 'Fixed ToolWindow
Caption = "Form2"
ClientHeight = 645
ClientLeft = 45
ClientTop = 360
ClientWidth = 4680
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 645
ScaleWidth = 4680
ShowInTaskbar = 0 'False
StartUpPosition = 3 '窗口缺省
Visible = 0 'False
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Implements olelib.IBindStatusCallback 'initialize the IBindStatusCallback interface... otherwise, you'll get no progress reports
Private Function StartTheStinkinDownLoad(ByVal File2DownLoad As String, ByVal File2Save As String) As Boolean
Dim DownLoadResult As Long
DownLoadResult = olelib.URLDownloadToFile(Nothing, File2DownLoad, File2Save, 0, Me)
StartTheStinkinDownLoad = (DownLoadResult = olelib.S_OK)
End Function
Private Sub IBindStatusCallback_OnProgress(ByVal ulProgress As Long, ByVal ulProgressMax As Long, ByVal ulStatusCode As olelib.BINDSTATUS, ByVal szStatusText As Long)
On Error GoTo BadDeal
If ulProgressMax <= 0 Then Exit Sub
Exit Sub
BadDeal:
Form1.Text5 = "0"
Resume Next
End Sub
Private Sub IBindStatusCallback_OnStartBinding(ByVal dwReserved As Long, ByVal pib As olelib.IBinding)
End Sub
Private Sub IBindStatusCallback_OnStopBinding(ByVal hresult As Long, ByVal szError As Long)
End Sub
Private Sub IBindStatusCallback_GetBindInfo(grfBINDF As olelib.BINDF, pbindinfo As olelib.BINDINFO)
End Sub
Private Function IBindStatusCallback_GetPriority() As Long
End Function
Private Sub IBindStatusCallback_OnDataAvailable(ByVal grfBSCF As olelib.BSCF, ByVal dwSize As Long, pformatetc As olelib.FORMATETC, pStgmed As olelib.STGMEDIUM)
End Sub
Private Sub IBindStatusCallback_OnLowResource(ByVal reserved As Long)
End Sub
Private Sub IBindStatusCallback_OnObjectAvailable(riid As olelib.UUID, ByVal pUnk As stdole.IUnknown)
End Sub
Public Function ShowDownLoad(FileList As String, Optional Owner As Object)
Dim i, X As Integer
i = Split(FileList, ",")
Dim File2DownLoad As String, File2Save As String, DeleteCache As Boolean, TopLimit As Integer, TempDelete As String, OffSet As Integer
TopLimit = (UBound(i) - 2) / 3 'filelist comes in as:File2DownLoad,File2Save,DeleteCache
OffSet = 0
For X = 0 To TopLimit
File2DownLoad = i(OffSet)
File2Save = i(OffSet + 1)
TempDelete = i(OffSet + 2)
If TempDelete = "1" Then
DeleteCache = True
Else
DeleteCache = False
End If
OffSet = OffSet + 3 'increment the offset for next file
Form1.Text4.Text = Form1.Text4.Text & "开始下载文件..." & vbCrLf
Form1.Text4.Text = Form1.Text4.Text & File2DownLoad & vbCrLf
If DeleteCache Then
If DeleteUrlCacheEntry(File2DownLoad) = 1 Then 'found and deleted
Form1.Text4.Text = Form1.Text4.Text & "找到上次下载缓存文件删除..." & vbCrLf
Else
Form1.Text4.Text = Form1.Text4.Text & "没有缓存文件存在" & vbCrLf 'no local copy existed
End If
End If
' Label1.Caption = File2DownLoad
If StartTheStinkinDownLoad(File2DownLoad, File2Save) Then
Form1.Text4.Text = Form1.Text4.Text & " 文件下载完毕!" & vbCrLf
ShowDownLoad = True
Else
Form1.Text5 = "0"
ShowDownLoad = False
End If
Next
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -