📄 form2.frm
字号:
End
Begin VB.Label Command4
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "Download With Internet Explorer"
BeginProperty Font
Name = "MS Sans Serif"
Size = 7.8
Charset = 0
Weight = 400
Underline = -1 'True
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 396
Left = 48
MouseIcon = "Form2.frx":0A1C
MousePointer = 99 'Custom
TabIndex = 26
Top = 3120
Width = 1500
End
Begin VB.Label Label8
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Sean Gallardy's OCX Downloader Code"
BeginProperty Font
Name = "MS Sans Serif"
Size = 7.8
Charset = 0
Weight = 400
Underline = -1 'True
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 192
Left = 2736
MouseIcon = "Form2.frx":0B6E
MousePointer = 99 'Custom
TabIndex = 23
Top = 2928
Width = 2856
End
Begin VB.Label Label6
BorderStyle = 1 'Fixed Single
Caption = "Thanks goes out to Sean Gallardy for submitting this downloader ocx control."
ForeColor = &H00008000&
Height = 540
Left = 48
TabIndex = 22
Top = 2112
Width = 5532
End
Begin VB.Image Image1
BorderStyle = 1 'Fixed Single
Height = 516
Left = 96
Picture = "Form2.frx":0CC0
Stretch = -1 'True
Top = 96
Width = 516
End
Begin VB.Image Image2
Height = 336
Left = 48
Picture = "Form2.frx":158A
Stretch = -1 'True
Top = 3168
Width = 336
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public FileSize
Public FileName
Public Read, TLeft, Speed
Private Sub Command1_Click()
On Error Resume Next
DownLoad1.Cancel
Unload Me
End Sub
Private Sub Command2_Click()
On Error Resume Next
Shell "Explorer " & Chr(34) & Right(SaveTo.Caption, Len(SaveTo.Caption) - 9) & Chr(34), vbNormalFocus
Unload Me
End Sub
Private Sub Command3_Click()
On Error Resume Next
Shell "start " & Chr(34) & Right(SaveTo.Caption, Len(SaveTo.Caption) - 9) & "\" & CurFile.Caption & Chr(34), vbHide
End Sub
Private Sub Command4_Click()
On Error Resume Next
Shell "start " & Chr(34) & Replace(CurURL.Caption, "+", " ") & Chr(34), vbHide
End Sub
Private Sub DownLoad1_DLComplete()
On Error Resume Next
Command3.Enabled = True
If Check1.Value = 1 Then
Open App.Path & "\DSETT.ini" For Output As #1
Write #1, vbCrLf & "CLS:1" & vbCrLf
Close #1
Unload Me
Else
Open App.Path & "\DSETT.ini" For Output As #1
Write #1, vbCrLf & "CLS:0" & vbCrLf
Close #1
Me.ZOrder
End If
Command1.Caption = "Close"
End Sub
Private Sub DownLoad1_Rate(lpRate As String)
On Error Resume Next
Speed = lpRate
End Sub
Private Sub DownLoad1_RecievedBytes(lnumBYTES As Long)
On Error Resume Next
Progress.Value = lnumBYTES
Read = lnumBYTES
Percent.Caption = Round(Progress.Value / Progress.Max * 100, 0) & "%"
End Sub
Private Sub DownLoad1_StatusChange(lpStatus As String)
On Error Resume Next
Label6.Caption = lpStatus
End Sub
Private Sub DownLoad1_TimeLeft(lpTime As String)
On Error Resume Next
TLeft = lpTime
End Sub
Private Sub Form_Load()
On Error Resume Next
Open App.Path & "\DINFO.tmp" For Input As #1
If Err.Number = 53 Then
Unload Me
Exit Sub
End If
i = 0
Do While Not EOF(1)
Line Input #1, strtextline
If i = 0 Then GoTo NextLine
If i = 1 And Left(strtextline, 3) = "URL" Then _
CurURL.Caption = Right(strtextline, Len(strtextline) - 4)
If i = 1 And Left(strtextline, 3) = "FLE" Then _
CurFile.Caption = Right(strtextline, Len(strtextline) - 4)
If i = 1 And Left(strtextline, 3) = "USR" Then _
CurUSER.Caption = "Current User: " & Right(strtextline, Len(strtextline) - 4)
NextLine:
i = 1
Loop
Close #1
Kill App.Path & "\DINFO.tmp"
Open App.Path & "\DSETT.ini" For Input As #1
If Err.Number = 53 Then
Check1.Value = 0
GoTo Continue
End If
i = 0
Do While Not EOF(1)
Line Input #1, strtextline
If i = 0 Then GoTo NextLine1
If i = 1 And Left(strtextline, 3) = "CLS" Then _
Check1.Value = Val(Right(strtextline, Len(strtextline) - 4))
NextLine1:
i = 1
Loop
Close #1
Continue:
Me.Show
DownLoad1.Url = CurURL.Caption
DownLoad1.GetFileInformation
FileSize = DownLoad1.FileSize
MkDir App.Path & "\My Downloaded Files"
SaveTo.Caption = App.Path & "\My Downloaded Files"
DownLoad1.SaveLocation = SaveTo.Caption & "\" & CurFile.Caption
SaveTo.Caption = "Save To: " & SaveTo.Caption
Progress.Max = FileSize
DownLoad1.DownLoad
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
DownLoad1.Cancel
End Sub
Private Sub Label8_Click()
On Error Resume Next
Shell "start http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=23693&lngWId=1", vbHide
End Sub
Private Sub Timer1_Timer()
On Error Resume Next
If Right(CurFile.Caption, 3) = "mp3" Then
Command3.Enabled = True
Else
If Command1.Caption <> "Close" Then Command3.Enabled = False
End If
Temp = Read
If Temp > 1000 Then
Temp = Temp / 1000
If Temp > 1000 Then
Temp = Temp / 1000
If Temp > 1000 Then
Temp = Temp / 1000
BytesRead.Caption = Round(Temp, 2) & " gb"
Else
BytesRead.Caption = Round(Temp, 2) & " mb"
End If
Else
BytesRead.Caption = Round(Temp, 2) & " kb"
End If
Else
BytesRead.Caption = Round(Temp, 2) & " bytes"
End If
Temp = Progress.Max - Progress.Value
If Temp > 1000 Then
Temp = Temp / 1000
If Temp > 1000 Then
Temp = Temp / 1000
If Temp > 1000 Then
Temp = Temp / 1000
BytesLeft.Caption = Round(Temp, 2) & " gb"
Else
BytesLeft.Caption = Round(Temp, 2) & " mb"
End If
Else
BytesLeft.Caption = Round(Temp, 2) & " kb"
End If
Else
BytesLeft.Caption = Round(Temp, 2) & " bytes"
End If
CurSpeed.Caption = Replace(Speed, "KB/S", "k/sec")
TimeLeft.Caption = TLeft
Me.Caption = Percent.Caption & " Downloaded: " & CurFile.Caption
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -