?? form1.frm
字號:
Height = 255
Left = 120
TabIndex = 31
Top = 5160
Width = 9975
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "要下載的文件網址:"
Height = 180
Left = 120
TabIndex = 23
Top = 2760
Width = 1530
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "毫秒"
Height = 180
Left = 3960
TabIndex = 15
Top = 1320
Width = 360
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "超時時長:"
Height = 180
Left = 1920
TabIndex = 13
Top = 1320
Width = 810
End
Begin VB.Menu mnuFile
Caption = "文件(&F)"
Begin VB.Menu mnuBegin
Caption = "開始下載"
End
Begin VB.Menu mnuStop
Caption = "停止下載"
End
Begin VB.Menu mnuBar
Caption = "-"
End
Begin VB.Menu mnuReg
Caption = "購買控件"
End
Begin VB.Menu mnubar0
Caption = "-"
End
Begin VB.Menu mnuExit
Caption = "退出"
End
End
Begin VB.Menu mnuHelp
Caption = "幫助(&H)"
Begin VB.Menu mnuOcx
Caption = "控件使用幫助"
End
Begin VB.Menu mnuBar1
Caption = "-"
End
Begin VB.Menu mnuEmail
Caption = "作者信箱"
End
Begin VB.Menu mnuWeb
Caption = "作者主頁"
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'
'金鋒文件下載控件 3.0 下載文件的示例程序
'
'在使用DownFile方法下載文件時,如果要指定非常規服務器端口號,可以在服務器域名后加“:端口號”
'如:http://www.xxx.com:8080/xxx.zip、ftp://ftp.xxx.com:1000/xxx.zip
'
'在使用DownFile方法下載文件時,如果要指定HTTP或FTP服務器用戶名密碼可以像這樣:
'ftp://用戶名:密碼@ftp.xxx.com/xxx.zip
'http://用戶名:密碼@www.xxx.com/xxx.zip
'
'本示例程序僅僅是簡單的演示了在一般情況下使用《金鋒文件下載控件》下載文件的方法。
'
'有關控件的一些重要屬性、方法在某些特殊情況下的特殊作用等的說明請參略《金鋒文件下載控件使用幫助》
'
'
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Sub Check1_Click()
jfDownEX1.ShowText = Check1.Value
End Sub
Private Sub Command1_Click()
On Error GoTo p1
DLG.Flags = &H1 Or &H2
DLG.Color = jfDownEX1.BackColor
DLG.ShowColor
jfDownEX1.BackColor = DLG.Color '設置進度條背景色
p1:
End Sub
Private Sub Command2_Click()
On Error GoTo p1
DLG.Flags = &H1 Or &H2
DLG.Color = jfDownEX1.ForeColor
DLG.ShowColor
jfDownEX1.ForeColor = DLG.Color '設置進度條前景色
p1:
End Sub
Private Sub Command3_Click()
On Error GoTo p1
DLG.Flags = &H1 Or &H2
DLG.Color = jfDownEX1.Color
DLG.ShowColor
jfDownEX1.Color = DLG.Color
p1:
End Sub
Private Sub Command4_Click()
On Error GoTo p1
DLG.Flags = cdlCFScreenFonts
DLG.ShowFont
'設置進度條字體
jfDownEX1.Font.Bold = DLG.FontBold
jfDownEX1.Font.Italic = DLG.FontItalic
jfDownEX1.Font.Name = DLG.FontName
jfDownEX1.Font.Size = DLG.FontSize
jfDownEX1.Font.Underline = DLG.FontUnderline
jfDownEX1.Font.Strikethrough = DLG.FontStrikethru
p1:
End Sub
Private Sub Command5_Click()
ShellExecute hwnd, "open", "http://www.jinfengsoft.net/soft/jfdown/login.htm", "", "", 1
End Sub
Private Function CheckSet() As Boolean
CheckSet = False
If Trim(Text4.Text) = "" Then
MsgBox "請輸入正確的網址!", 16 Or vbOKOnly
Exit Function
End If
jfDownEX1.ProxyServer = Text1.Text '設置代理服務器
jfDownEX1.ProxyPort = Val(Text2.Text) '設置代理服務器端口
jfDownEX1.UseProxy = Check3.Value '設置是否使用代理服務器
jfDownEX1.UseCookie = Check2.Value '設置是否使用Cookie
jfDownEX1.TimeOut = Val(Text1.Text) '設置超時時長
jfDownEX1.UseReferer = Check4.Value '設置是否使用提交方來源
jfDownEX1.Referer = Text5.Text '設置提交方來源地址(如果為空,控件將自動取文件下載的目錄地址作為提交方來源)
CheckSet = True
End Function
Private Sub Command6_Click()
On Error GoTo p1
If Not CheckSet Then Exit Sub
DLG.Flags = &H2
DLG.ShowSave
If Dir(DLG.FileName, 0 + 1 + 2 + 4) <> "" Then
If MsgBox("是否使用斷點續傳功能?", vbYesNo + 32) = vbYes Then
jfDownEX1.DownFile Text4.Text, DLG.FileName, FileLen(DLG.FileName), True '從斷點處續傳文件
Exit Sub
Else
Kill DLG.FileName
End If
End If
jfDownEX1.DownFile Text4.Text, DLG.FileName, 0, True '從0字節處下載文件
p1:
End Sub
Private Sub Command7_Click()
If Not CheckSet Then Exit Sub
If jfDownEX1.GetUrlInfo(Text4.Text) Then
tmp = "文件名:" & jfDownEX1.ContentFilename & vbCrLf & "文件體積:" & jfDownEX1.FileLength & vbCrLf & "文件最后更新日期:" & jfDownEX1.Last_Modified & vbCrLf
tmp = tmp & "文件真實地址:"
If jfDownEX1.UseFtp Then
tmp = tmp & "ftp://"
If jfDownEX1.FtpUserName <> "anonymous" Then tmp = tmp & jfDownEX1.FtpUserName & ":" & jfDownEX1.FtpPassWord & "@"
tmp = tmp & jfDownEX1.Server
If jfDownEX1.Port <> 21 Then tmp = tmp & ":" & jfDownEX1.Port
tmp = tmp & jfDownEX1.FilePath
Else
tmp = tmp & "http://"
If jfDownEX1.UseHttpUser Then tmp = tmp & jfDownEX1.HttpUserName & ":" & jfDownEX1.HttpPassWord & "@"
tmp = tmp & jfDownEX1.Server
If jfDownEX1.Port <> 80 Then tmp = tmp & ":" & jfDownEX1.Port
tmp = tmp & jfDownEX1.FilePath
End If
MsgBox tmp, vbInformation
Else
MsgBox "獲取文件屬性失敗!", 16
End If
Label6.Caption = "就緒"
'ContentFilename 屬性返回要下載的文件的文件名
'FileLength 屬性返回要下載的文件的體積
'Last_Modified 屬性返回要下載的文件的最后更新時間
End Sub
Private Sub Command8_Click()
ShellExecute hwnd, "open", "http://www.softreg.com.cn/shareware_view.asp?id=/AB77B40C-778C-4B17-A0FB-3E4423A72E6C/#regform", "", "", 1
End Sub
Private Sub Command9_Click()
End
End Sub
Private Sub jfaddline(ByVal txt As String)
Text6.Text = Text6.Text & txt & vbCrLf
Text6.SelStart = Len(Text6.Text)
End Sub
Private Sub jfDownEX1_OnCompleted()
Label6.Caption = "下載完成"
End Sub
Private Sub jfDownEX1_OnError(ByVal ErrorMessage As String, ByVal ErrorID As Long)
jfaddline ("發生錯誤 " & ErrorID & ":" & ErrorMessage & ",關閉連接。")
jfDownEX1.CloseLink '關閉連接及打開的文件
End Sub
Private Sub jfDownEX1_OnGetData()
Label6.Caption = "正在下載(" & jfDownEX1.Progress & "/" & jfDownEX1.FileLength & ")..."
'Progress 屬性返回當前文件下載進度(以字節為單位,即返回已下載了多少字節)
End Sub
Private Sub jfDownEX1_OnKilllink()
jfaddline ("已斷開連接")
End Sub
Private Sub jfDownEX1_OnLinked()
Label6.Caption = "已連接到" & jfDownEX1.Server
jfaddline "已連接" & jfDownEX1.Server
End Sub
Private Sub jfDownEX1_OnLinking()
Label6.Caption = "正在連接" & jfDownEX1.Server & "..."
jfaddline "正在連接" & jfDownEX1.Server & "..."
End Sub
Private Sub jfDownEX1_OnRecvCommand(ByVal CommandStr As String) '當控件向服務器發送命令時發生該事件
jfaddline (CommandStr)
' CommandStr 是控件向服務器發送的命令(但并不完全是,有些是控件自加的信息)
End Sub
Private Sub jfDownEX1_OnSendCommand(ByVal CommandStr As String) '當服務器返回信息時發生該事件
jfaddline (CommandStr)
' CommandStr 是服務器返回的命令(但并不完全是,有些是控件自加的信息)
End Sub
Private Sub mnuBegin_Click()
Command6_Click
End Sub
Private Sub mnuEmail_Click()
jfDownEX1.GetSupport
End Sub
Private Sub mnuExit_Click()
End
End Sub
Private Sub mnuOcx_Click()
ShellExecute hwnd, "open", "http://www.jinfengsoft.net/soft/jfdown/index.htm", "", "", 1
End Sub
Private Sub mnuReg_Click()
Command8_Click
End Sub
Private Sub mnuStop_Click()
jfDownEX1.CloseLink
End Sub
Private Sub mnuWeb_Click()
jfDownEX1.GotoWeb
End Sub
Private Sub Option1_Click(Index As Integer)
jfDownEX1.Kind = Index
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -