📄 data.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "数据转换程序 V1.0"
ClientHeight = 5760
ClientLeft = 4455
ClientTop = 2715
ClientWidth = 6390
ForeColor = &H00000000&
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 5760
ScaleWidth = 6390
Begin VB.Timer Timer2
Interval = 300
Left = -120
Top = 5520
End
Begin VB.CommandButton Command3
Caption = "退出程序"
Height = 495
Left = 4320
TabIndex = 5
Top = 5160
Width = 1575
End
Begin VB.Timer Timer1
Interval = 1000
Left = 6120
Top = 5520
End
Begin VB.Frame Frame1
Caption = "进程显示"
ForeColor = &H00808000&
Height = 4215
Left = 360
TabIndex = 1
Top = 600
Width = 5655
Begin VB.TextBox Text4
ForeColor = &H00008000&
Height = 270
Left = 360
TabIndex = 14
Text = "请输入要转换的数据文件路径"
Top = 480
Width = 4935
End
Begin VB.TextBox Text3
ForeColor = &H00008000&
Height = 270
Left = 360
Locked = -1 'True
TabIndex = 10
Top = 1200
Width = 4935
End
Begin VB.TextBox Text2
BeginProperty Font
Name = "宋体"
Size = 21.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 360
Locked = -1 'True
TabIndex = 7
Top = 3240
Width = 4935
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 21.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 360
Locked = -1 'True
TabIndex = 6
Text = " "
Top = 2040
Width = 4935
End
Begin VB.Label Label9
Caption = "转换数据路径"
ForeColor = &H000040C0&
Height = 255
Left = 2280
TabIndex = 15
Top = 240
Width = 1095
End
Begin VB.Label Label8
ForeColor = &H00808000&
Height = 225
Left = 1920
TabIndex = 13
Top = 3960
Width = 1845
End
Begin VB.Label Label7
ForeColor = &H00808000&
Height = 225
Left = 120
TabIndex = 12
Top = 3960
Width = 1095
End
Begin VB.Label Label6
Caption = "自动生成路径"
ForeColor = &H000040C0&
Height = 255
Left = 2280
TabIndex = 11
Top = 960
Width = 1215
End
Begin VB.Label Label5
Caption = "转换数据窗口"
ForeColor = &H000040C0&
Height = 255
Left = 2280
TabIndex = 9
Top = 3000
Width = 1095
End
Begin VB.Label Label4
Caption = "读入数据窗口 "
ForeColor = &H000040C0&
Height = 255
Left = 2280
TabIndex = 8
Top = 1800
Width = 1095
End
Begin VB.Label Label3
ForeColor = &H00808000&
Height = 225
Left = 4800
TabIndex = 4
Top = 3960
Width = 735
End
End
Begin VB.CommandButton Command2
Caption = "转换数据"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2400
TabIndex = 0
Top = 5160
Width = 1575
End
Begin VB.Label Label2
Caption = "延寿前兆数据转换程序"
BeginProperty Font
Name = "隶书"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000040C0&
Height = 375
Left = 1920
TabIndex = 3
Top = 360
Width = 3015
End
Begin VB.Label Label1
Caption = "欢迎使用哈尔滨地震监测中心软件"
BeginProperty Font
Name = "楷体_GB2312"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00808000&
Height = 255
Left = 3600
TabIndex = 2
Top = 0
Width = 2775
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Public mubiaoFILEname As Boolean 'MubiaoFILEname 在form2中也调用,应定义公用变量
'Public YuanFILEname As Boolean ************但是不可写在这里******应写在模块中**********
Option Explicit
Dim FileNum As Integer '打开文件的文件号
Dim evt_Size As Double, dat_Size As Double '打开文件(dat/evt)长度
Dim DataStr As Byte '单字节10进制数******存1个字节的读数据(10进制)
Dim DataHex As String '单字节/字符******存1个字节的读数据(表示16进制的字符)
Dim inFileName As String
Dim outFileName As String, exFile As String
Dim dateNow As String
Dim outLocation As Double
Dim SuoFile As String
'************************** Command2 写数据到一个新的*.dat文件_2 ************************************************
Private Sub Command2_Click()
On Error Resume Next
outLocation = 0
evt_Size = LOF(1) '返回1#文件的字节长度
Do While outLocation < evt_Size ' 循环至文件尾。
outLocation = outLocation + 1 ' 取得所读数据的当前位置。
Label7 = outLocation & "bytes"
Get #1, outLocation, DataStr '取数from 港震(#1文件)TO DataStr
'DataStr为单字节10进制数******存1个字节的读数据(10进制)
DataHex = Hex$(DataStr) '转成16进制(字符表达)*****注意DataHex As String
If DataHex <> "0" Then '显示控制--0数据不显示
Text1.Text = " " & DataStr & " " & DataHex
DelayTime
End If
Put #2, outLocation, DataStr '存数 to 索
DataHex = Hex$(DataStr)
If DataHex <> "0" Then '显示控制--0数据不显示
Text2.Text = " " & DataStr & " " & DataHex
End If
If Form1.Visible = False Then
GoTo Line2
End If
Loop
MsgBox ("转换文件已写入完毕")
Close #2
Line2: '标号2
End Sub
Private Sub Command3_Click() '关闭程序
Close #1
Close #2
Unload Me
End Sub
'****************************************初始化******************************************************
Private Sub Form_Load()
End Sub
Private Sub Text3_Click()
mubiaoFILEname = True
YuanFILEname = False
Form2.Show
End Sub
''Private Sub Timer1_Timer()
'' If Form1.Visible = False Then
'' Unload Me
'' Else
'' Label3 = Format(Now, "hh:mm:ss")
''End Sub
''Private Sub Timer2_Timer()
''If Form1.Visible = False Then
'' Unload Me
''End If
''End Sub
'****************延时程序*******************
Private Sub DelayTime()
Dim TimerOld, TimerOffset As Single
TimerOld = Timer
Do
TimerOffset! = Timer - TimerOld
If TimerOffset! < 0 Then
TimerOffset = TimerOffset + 1
End If
If TimerOffset >= 1E-40 Then
Exit Do
End If
DoEvents
Loop
End Sub
Private Sub Text4_click()
mubiaoFILEname = False
YuanFILEname = True
Form2.Show
End Sub
Private Sub Text4_change()
Text4.Text = Form2.Text1.Text
''inFileName = Text4.Text
'' dateNow = Format(Now, "yyyymmddhhmmss") '用于文件名
' ***suo文件长度为12字符(25055739.044),前一个字符为“\”,依此初判suo文件。
'' SuoFile = Right(inFileName, 13)
'' SuoFile = Left(SuoFile, 1)
'' If SuoFile <> "\" Then
'' MsgBox "请正确输入要转换数据的文件路径!!"
'' GoTo Line4
'' Else
'' exFile = "evt"
''
''Line3: '标号1
'' Open inFileName For Binary Access Read Lock Write As #1 '打开要转换的源文件
'' outFileName = "i:\suo_gang\" & exFile & "\" & dateNow & "." & exFile '自动以当前日期为文件名
'' Text3.Text = outFileName
'' Open outFileName For Binary Access Write As #2 '创建输出文件
'' End If
'' evt_Size = LOF(1) '返回1#文件的字节长度
'' Label8 = "文件大小:" & evt_Size & "bytes"
''Line4:
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -