?? form4.frm
字號:
VERSION 5.00
Object = "{74848F95-A02A-4286-AF0C-A3C755E4A5B3}#1.0#0"; "actskn43.ocx"
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form Form4
BorderStyle = 1 'Fixed Single
Caption = "升級提示"
ClientHeight = 4800
ClientLeft = 45
ClientTop = 435
ClientWidth = 6915
Icon = "Form4.frx":0000
LinkTopic = "Form4"
MaxButton = 0 'False
ScaleHeight = 4800
ScaleWidth = 6915
StartUpPosition = 1 '所有者中心
Begin VB.TextBox Text3
Height = 270
Left = 600
TabIndex = 6
Text = "Text2"
Top = 4800
Width = 255
End
Begin MSWinsockLib.Winsock Winsock1
Left = 5520
Top = 4200
_ExtentX = 741
_ExtentY = 741
_Version = 393216
End
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 100
Left = 2280
Top = 0
End
Begin VB.Frame Frame1
Caption = "新版升級說明"
Height = 3735
Left = 120
TabIndex = 4
Top = 480
Width = 6615
Begin VB.TextBox Text1
Height = 3375
Left = 120
Locked = -1 'True
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 5
Text = "Form4.frx":000C
Top = 240
Width = 6375
End
End
Begin VB.CommandButton Command2
Caption = "跳 過"
Height = 375
Left = 3720
TabIndex = 3
Top = 4320
Width = 1455
End
Begin VB.CommandButton Command1
Caption = "我要升級"
Height = 375
Left = 1680
TabIndex = 2
Top = 4320
Width = 1455
End
Begin ACTIVESKINLibCtl.Skin pkskn
Left = 120
OleObjectBlob = "Form4.frx":001D
Top = 0
End
Begin ACTIVESKINLibCtl.SkinLabel SkinLabel2
Height = 375
Left = 5280
OleObjectBlob = "Form4.frx":0251
TabIndex = 1
Top = 240
Width = 1455
End
Begin ACTIVESKINLibCtl.SkinLabel SkinLabel1
Height = 375
Left = 5280
OleObjectBlob = "Form4.frx":02AF
TabIndex = 0
Top = 0
Width = 1575
End
End
Attribute VB_Name = "Form4"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim DataByte() As Byte
Dim StartTime As Date '連接服務器的時間
Dim UPI As Boolean
Private Sub Command1_Click()
'Shell "Rundll32.exe " & App.Path & "\update.exe", vbNormalFocus
Shell App.Path & "\Update.exe", vbNormalFocus
'ShellForWait App.Path & "\update.exe", , &HFFFF
'Shell "Explorer /s ," & App.Path & "\update.exe"
End
End Sub
Private Sub Command2_Click()
On Error Resume Next
EXIT_UP = True
Unload Me
Form1.Show
End Sub
Private Sub Form_Load()
pkskn.LoadSkin App.Path & "\chizh.skn"
pkskn.ApplySkinByName hWnd, "窗體"
pkskn.ApplySkin hWnd
SkinLabel1.Caption = "當前版本號:" & VersionN
SkinLabel2.Caption = "升級后版本:" & NEW_VersionN
UPTT
End Sub
Private Sub UPLIST_TXT()
If Dir(FileName, vbNormal) <> "" Then
Dim strinput As String
Dim intfile As Integer
intfile = FreeFile
filesize = FileLen(FileName)
Open FileName For Binary As #intfile
strinput = Space(filesize)
Get #intfile, , strinput
Close #intfile
Text1.Text = strinput
End If
End Sub
Public Sub UPTT()
StartTime = Time()
If Winsock1.State = 0 Then '或0,6代表正在連接,7代表連接成功
Winsock1.RemoteHost = UPIP '返回或設置遠程計算機,控件向它發送數據或從它那里接收數據。既可提供主機名,比如 "FTP://ftp.microsoft.com",也可提供點格式下的 IP 地址字符串,比如 "100.0.1.1"。
Winsock1.RemotePort = 80 '返回或設置要連接的遠程端口號
Winsock1.Connect
End If
Do While Winsock1.State <> sckConnected
DoEvents: DoEvents: DoEvents: DoEvents
'連接時間超過20秒或取消下載,退出該過程并返回false
If DateDiff("s", StartTime, Time()) > 20 Then
MsgBox "連接服務器時間過長!", vbInformation, "連接失敗!"
Exit Do
End If
Loop
Text3.Text = UPlist '必須經過文本處理,否則將會有許多未知字符出錯
strcommand = "GET " + Text3.Text + " HTTP/1.0" + vbCrLf 'GET 為FTP命令
strcommand = strcommand + vbCrLf '記住一定要加上vbCrLf
FileName = App.Path & "\" & "uplist.up"
If Dir(FileName) <> "" Then
Kill FileName
End If
If Dir(FileName, vbNormal) <> "" Then
Kill FileName
End If
bAppend = False
Winsock1.SendData strcommand ''給遠程計算機發送數據
Timer1.Enabled = True
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call Command2_Click
End Sub
Private Sub Timer1_Timer()
If UPboolean = True Then
UPboolean = False
FileName = App.Path & "\" & "uplist.up"
If FileLen(FileName) > 0 Then
UPLIST_TXT
End If
Timer1.Enabled = False
End If
End Sub
Private Sub Winsock1_Close()
Winsock1.Close
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim ByteData1() As Byte
'文件總長度的變量
Dim Flen1 As Long
'請求服務器返回的響應碼
Dim ReCode1 As String
Winsock1.GetData ByteData1, vbByte, bytesTotal
'下載數據保存數據,如果是連接后第一次返回的數據,返回服務器的響應碼
ReCode1 = SaveData(bytesTotal, ByteData1(), Flen1)
DoEvents '控制切換
Select Case ReCode1
Case "200"
'響應碼為200表示成功
Case "206"
'響應碼206表示斷點續傳成功
Case "404"
'響應碼為404表示請求的下載的文件未找到
MsgBox "文件不存在!", vbInformation, "下載失敗"
Winsock1.Close
Case "error"
'其他響應碼視為錯誤
Winsock1.Close
MsgBox "請求出錯!", vbInformation, "下載失敗"
Case "cancel"
'用戶取消
Exit Sub
End Select
If Flen1 > 0 Then
'如果任務第一次下載,則保存后得到文件長度
filesize = Flen1
End If
End Sub
Private Sub Winsock1_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
Winsock1.Close
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -