VERSION 5.00 Begin VB.Form Frm_Download Caption = "首图下载" ClientHeight = 4845 ClientLeft = 60 ClientTop = 345 ClientWidth = 11565 LinkTopic = "Form1" ScaleHeight = 4845 ScaleWidth = 11565 StartUpPosition = 2 '屏幕中心 Begin VB.TextBox folder Height = 285 Left = 1065 TabIndex = 3 Top = 0 Width = 10455 End Begin VB.CommandButton clear Caption = "清空" Height = 300 Left = 0 TabIndex = 2 Top = 540 Width = 1020 End Begin 导出商品首图.TzProgressBar pb Height = 255 Left = 1080 Top = 570 Width = 10440 _ExtentX = 18415 _ExtentY = 450 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "宋体" Size = 9 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Caption = "总进度" BackColor = 8438015 StartColor = 8438015 End Begin 导出商品首图.TzDownload dl Height = 255 Left = 1065 Top = 300 Width = 10440 _ExtentX = 18415 _ExtentY = 450 ForeColor = 16777088 End Begin VB.CommandButton dlc Caption = "下载" Height = 300 Left = 0 TabIndex = 1 Top = 255 Width = 1020 End Begin 导出商品首图.TzListBox SName Height = 4095 Left = 0 TabIndex = 0 Top = 840 Width = 6015 _ExtentX = 10610 _ExtentY = 7223 End Begin 导出商品首图.TzListBox UName Height = 4020 Left = 6015 TabIndex = 4 Top = 840 Width = 5505 _ExtentX = 9710 _ExtentY = 7091 End Begin VB.CommandButton fl Caption = "文件夹" Height = 270 Left = 0 TabIndex = 5 Top = 0 Width = 1020 End Begin VB.ListBox errnlist Height = 420 ItemData = "Frm_Download.frx":0000 Left = 3720 List = "Frm_Download.frx":0002 TabIndex = 6 Top = 2265 Visible = 0 'False Width = 1215 End Begin VB.ListBox errulist Height = 420 ItemData = "Frm_Download.frx":0004 Left = 8115 List = "Frm_Download.frx":0006 TabIndex = 7 Top = 2370 Visible = 0 'False Width = 1215 End End Attribute VB_Name = "Frm_Download" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Private sd As Boolean Private Savetime As Double Private Sub clear_Click() SName.clear UName.clear End Sub Private Sub dl_OnFinished(ByVal Result As Boolean) sd = Result End Sub Private Sub dlc_Click() 'On Error Resume Next If UName.ListCount = 0 Then MsgBox ("请先检索商品链接!"): Exit Sub Dim I As Long Dim UseTime As Double If folder = "" Or folder = Format(Now, "m.d") & "-首图-公司名称-阿里账号-提单人名称" Then folder = InputBox("请输入 日期-首图-公司名称-阿里账号-提单人名称!", , Format(Now, "m.d") & "-首图-公司名称-阿里账号-提单人名称") If folder = Format(Now, "m.d") & "-首图-公司名称-阿里账号-提单人名称" Then MsgBox "未修改文件夹名称,已取消导出!": Exit Sub UseTime = timeGetTime For I = 0 To UName.ListCount - 1 Dim failure failure = 0 red: pb.Change I, "下载中 进度: " & I & "/" & pb.BarMax UName.ListIndex = I SName.ListIndex = I dl.FileDownload UName.List(I), App.Path & "\" & folder & "\" & Trim(SName.List(I)) Do Sleep 50 Loop Until dl.IsFree If Not sd Then failure = failure + 1 If failure > 2 Then errnlist.AddItem SName.List(I) errulist.AddItem UName.List(I) Else GoTo red End If End If Next UseTime = Format((timeGetTime - UseTime) / 1000, "0.00") pb.Change pb.BarMax, "下载完成 共下载" & pb.BarMax & "件产品首图 耗时" & UseTime & "秒!" & IIf(errnlist.ListCount = 0, "", "下载失败 " & errnlist.ListCount & "张"), IIf(errnlist.ListCount = 0, &H80FF80, vbRed) Sleep 200 If errnlist.ListCount > 0 Then Frm_Err.ErrMsg = "下载期间发生错误导致以下图片下载失败!" & vbCrLf For I = 0 To errnlist.ListCount Frm_Err.ErrMsg = Frm_Err.ErrMsg & errnlist.List(I) & " " & errulist.List(I) & vbCrLf Next Frm_Err.Show 1 End If Shell "explorer.exe /n,/select," & App.Path & "\" & folder & "\", vbNormalFocus End Sub Private Sub fl_Click() Shell "explorer.exe /n,/select," & App.Path & "\" & folder & "\", vbNormalFocus End Sub Private Sub Form_Load() If folder = "" Then folder = Format(Now, "m.d") & "-首图-公司名称-阿里账号-提单人名称" End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) Me.Hide Cancel = True End Sub 'itempicurl (ix), App.Path & "\" & folder.Text & "\" & itemname(ix).Text & ".jpg" Private Sub Form_Resize() On Error Resume Next folder.Left = dlc.Left + dlc.Width + 10 folder.Width = Me.Width - dl.Left - 20 folder.Top = 0 dl.Left = dlc.Left + dlc.Width + 10 dl.Width = Me.Width - dl.Left - 20 dl.Top = 300 pb.Left = dlc.Left + dlc.Width + 10 pb.Width = Me.Width - dl.Left - 20 pb.Top = dl.Top + dl.Height + 50 SName.Left = 5 SName.Top = pb.Top + pb.Height + 50 SName.Height = Me.Height - 1200 SName.Width = Me.Width / 2 - 10 UName.Left = Me.Width / 2 + 10 UName.Top = SName.Top UName.Height = SName.Height UName.Width = SName.Width dlc.Top = dl.Top clear.Top = pb.Top End Sub Private Sub SName_dblClick() InputBox "您所选择的产品名称如下:", , SName.List(SName.ListIndex) End Sub Private Sub UName_AddItem() pb.BarMax = UName.ListCount pb.Change pb.BarMax, "以扫描到商品信息" & UName.ListCount & "条" End Sub Private Sub UName_dblClick() InputBox "您所选择的产品链接如下:", , UName.List(UName.ListIndex) End Sub