📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form From1
BorderStyle = 0 'None
Caption = "Recevie"
ClientHeight = 1170
ClientLeft = 0
ClientTop = 0
ClientWidth = 6750
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1170
ScaleWidth = 6750
ShowInTaskbar = 0 'False
StartUpPosition = 3 '窗口缺省
Begin VB.Timer Timer1
Interval = 200
Left = 3015
Top = 1875
End
Begin VB.Label Label4
Alignment = 2 'Center
Caption = "Byte"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 5655
TabIndex = 3
Top = 615
Width = 975
End
Begin VB.Label Label3
Alignment = 2 'Center
Caption = "正在准备接收主机数据中..........."
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 90
TabIndex = 2
Top = 210
Width = 6540
End
Begin VB.Label Label2
Alignment = 2 'Center
Caption = "当前接收数据:"
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 90
TabIndex = 1
Top = 615
Width = 2760
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "0"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 2865
TabIndex = 0
Top = 615
Width = 2760
End
End
Attribute VB_Name = "From1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public gFileName As String
Public gAddress As Integer
Public gPort As Long
Private Sub Form_Load()
Me.Move (Screen.Width - Me.Width) / 2, 3500
With mTools
If .INIGetSetting("RecevieCfg", "FileName", gFileName, mTools.JoinPath(App.Path, "RecevieCfg.ini")) = False Then
GoTo Err
End If
If .INIGetSetting("RecevieCfg", "Address", gAddress, mTools.JoinPath(App.Path, "RecevieCfg.ini")) = False Then
GoTo Err
End If
If .INIGetSetting("RecevieCfg", "Port", gPort, mTools.JoinPath(App.Path, "RecevieCfg.ini")) = False Then
GoTo Err
End If
End With
Call mTools.SetWindowUpMost(Me.hWnd, True)
Exit Sub
Err:
MsgBox "读取配置失败!"
End
End Sub
Private Sub Form_Unload(Cancel As Integer)
End
End Sub
Private Sub Timer1_Timer()
If RecevieFile(gPort, B19200, BIT_8 + STOP_1 + P_NONE, gAddress) = True Then
' 解压
Label3.Caption = "接收完毕,正在解压文件!"
FileSystem.ChDrive (Left(App.Path, 1))
FileSystem.ChDir (App.Path)
If FileSystem.Dir(mTools.JoinPath(App.Path, gFileName & ".mdb")) <> "" Then
Call FileSystem.Kill(mTools.JoinPath(App.Path, gFileName & ".mdb"))
End If
Call Shell("C:\Program Files\WinRAR\WinRAR.exe x " & gFileName & ".rar " & gFileName & ".mdb " & App.Path, vbHide)
Call Sleep(2000)
If FileSystem.Dir(mTools.JoinPath(App.Path, gFileName & ".rar")) <> "" Then
Call FileSystem.Kill(mTools.JoinPath(App.Path, gFileName & ".rar"))
End If
Label3.Caption = "解压文件OK,更新设置成功!"
Timer1.Enabled = False
Else
Label3.Caption = "未接收到数据!"
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -