📄 frmmdi.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "Comdlg32.ocx"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.MDIForm FrmMDI
BackColor = &H8000000C&
Caption = "上海金陵智能电表"
ClientHeight = 5205
ClientLeft = 165
ClientTop = 735
ClientWidth = 6765
Icon = "FrmMDI.frx":0000
LinkTopic = "MDIForm1"
LockControls = -1 'True
StartUpPosition = 3 '窗口缺省
WindowState = 2 'Maximized
Begin MSComDlg.CommonDialog CMDialog1
Left = 5520
Top = 4392
_ExtentX = 688
_ExtentY = 688
_Version = 393216
CancelError = -1 'True
DefaultExt = "exe"
DialogTitle = "选择程序所在路径及文件名"
Filter = "执行文件(*.exe)|*.exe|*.*"
End
Begin VB.Timer Timer1
Interval = 1000
Left = 5964
Top = 4440
End
Begin MSComctlLib.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 345
Left = 0
TabIndex = 1
Top = 4860
Width = 6765
_ExtentX = 11933
_ExtentY = 609
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin MSComctlLib.ImageList ImageList1
Left = 6300
Top = 4356
_ExtentX = 794
_ExtentY = 794
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 32
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 12
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmMDI.frx":0CCA
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmMDI.frx":0FE6
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmMDI.frx":1302
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmMDI.frx":161E
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmMDI.frx":193A
Key = ""
EndProperty
BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmMDI.frx":1D8E
Key = ""
EndProperty
BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmMDI.frx":21E2
Key = ""
EndProperty
BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmMDI.frx":24FE
Key = ""
EndProperty
BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmMDI.frx":2952
Key = ""
EndProperty
BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmMDI.frx":2DAE
Key = ""
EndProperty
BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmMDI.frx":320A
Key = ""
EndProperty
BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmMDI.frx":365E
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 600
Left = 0
Negotiate = -1 'True
TabIndex = 0
Top = 0
Width = 6765
_ExtentX = 11933
_ExtentY = 1058
ButtonWidth = 2249
ButtonHeight = 1005
Appearance = 1
Style = 1
TextAlignment = 1
ImageList = "ImageList1"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 5
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "读电量 "
Object.ToolTipText = "抄读电能表中存储的数据"
ImageIndex = 3
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "读状态 "
Object.ToolTipText = "读电表运行状态的各项参数"
ImageIndex = 12
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
EndProperty
BorderStyle = 1
OLEDropMode = 1
End
Begin VB.Menu DATA_COM
Caption = "抄表功能(&C)"
Begin VB.Menu READ_DATA
Caption = "读电量(&E)"
End
Begin VB.Menu READ_STATUE
Caption = "读状态(&R)"
End
End
Begin VB.Menu COMPORT
Caption = "通讯端口"
Begin VB.Menu COM1
Caption = "COM1"
End
Begin VB.Menu COM2
Caption = "COM2"
End
Begin VB.Menu COM3
Caption = "COM3"
End
Begin VB.Menu COM4
Caption = "COM4"
End
End
Begin VB.Menu WINDOW
Caption = "窗口(&W)"
WindowList = -1 'True
Begin VB.Menu mnuWindowCascade
Caption = "层叠"
End
Begin VB.Menu mnuWindowArrange
Caption = "平铺"
End
Begin VB.Menu mnuWindowTile
Caption = "排列"
End
End
Begin VB.Menu ABOUT_F
Caption = "关于(&A)"
End
End
Attribute VB_Name = "FrmMDI"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub COM1_Click()
COM1.Checked = True
COM2.Checked = Not COM1.Checked
COM3.Checked = Not COM1.Checked
COM4.Checked = Not COM1.Checked
With StatusBar1.Panels
.item(2).Text = "COM1"
End With
B_COMPORT = 1
mydata.comnumber = 1 '直接与表通讯缺省使用的COM
End Sub
Private Sub COM2_Click()
COM2.Checked = True
COM1.Checked = Not COM2.Checked
COM3.Checked = Not COM2.Checked
COM4.Checked = Not COM2.Checked
With StatusBar1.Panels
.item(2).Text = "COM2"
End With
B_COMPORT = 2
mydata.comnumber = 2 '直接与表通讯缺省使用的COM
End Sub
Private Sub COM3_Click()
COM3.Checked = True
COM1.Checked = Not COM3.Checked
COM2.Checked = Not COM3.Checked
COM4.Checked = Not COM3.Checked
With StatusBar1.Panels
.item(2).Text = "COM3"
End With
B_COMPORT = 3
mydata.comnumber = 3 '直接与表通讯缺省使用的COM
End Sub
Private Sub COM4_Click()
COM4.Checked = True
COM1.Checked = Not COM4.Checked
COM2.Checked = Not COM4.Checked
COM3.Checked = Not COM4.Checked
With StatusBar1.Panels
.item(2).Text = "COM4"
End With
B_COMPORT = 4
mydata.comnumber = 4 '直接与表通讯缺省使用的COM
End Sub
' 声明变量
Private Sub MDIFORM_Load()
Dim j As Byte
ChDir App.path '总是将工作路径设为当前路径
mypath = App.path + "\setinf.res"
Myfile = Dir(mypath, vbNormal)
If Myfile = "" Then
With mydata
For j = 0 To 3
.int_power(j) = "000000.00"
Next
For j = 0 To 15
.diselec(j) = 1
Next
.detime1 = "03"
.detime2 = "01"
.autoday(0) = "0": mydata.autoday(1) = "25"
'.bh = "000000000000"
.comnumber = 1
.BOUTRATE = 1200
.dbcs = "001600"
.times = 2
.timetabel(0) = 2
.timetabel(1) = 23
.timetabel(2) = 0
.timetabel(3) = 1
.timetabel(4) = 12
.timetabel(5) = 30
For n = 2 To 11
.timetabel(3 * n) = 3
Next
.Datapath = App.path
End With
Open mypath For Binary Shared As #1
Put #1, 1, mydata
Close #1
Else
mydata.Datapath = mypath
Open mypath For Binary Shared As #1
Get #1, 1, mydata
Close #1
End If
B_COMPORT = mydata.comnumber '直接与表通讯缺省使用的COM
If B_COMPORT = 1 Then
COM1.Checked = True
Else
COM2.Checked = True
End If
Dim i As Integer
For i = 1 To 8
StatusBar1.Panels.Add
Next i
With StatusBar1.Panels
.item(1).Width = 1300
.item(1).Text = "当前通讯口"
.item(2).Width = 1100
.item(2).Text = "COM" + CStr(B_COMPORT)
.item(3).Width = 1100
.item(3).Text = "波特率"
.item(4).Width = 1100
.item(4).Text = CStr(mydata.BOUTRATE) + "bit"
.item(5).Width = 3800
.item(5).Bevel = sbrNoBevel '空白
.item(6).Width = 1500
.item(6).Text = Date$
.item(7).Width = 1000
.item(7).Text = myweekday
.item(8).Width = 1300
.item(8).Text = Time$
End With
end_s = True
End Sub
Private Sub MDIForm_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Dim msg ' 声明变量。
' 设置信息文本。
msg = "你确实要关闭程序吗?"
' 如果用户单击 No 按钮,则停止QueryUnload。
If MsgBox(msg, vbQuestion + vbYesNo, Me.Caption) = vbNo Then Cancel = True
Unload frm_msg
Open mypath For Binary Shared As #1
Put #1, 1, mydata
Close #1
End Sub
Private Sub ABOUT_F_Click()
frmAbout.Show
End Sub
Private Sub BRAUD_Click()
frm_gbcommand.Show
frm_gbcommand.SetFocus
End Sub
Private Sub mnuSETUP_Click()
Dim ReturnValue
Dim Z As Byte, Y As String
On Error Resume Next
ReturnValue = Shell(mydata.path, 1)
If ReturnValue <> "" Then
AppActivate ReturnValue ' 激活设置程序
Else
'寻找设置程序"
FrmMDI.CMDialog1.FileName = "multiratetable.exe"
On Error Resume Next
CMDialog1.ShowOpen
If Err = 32755 Then 'User chose Cancel.所以取消此操作。
On Error GoTo ErrHandler
End If
mydata.path = FrmMDI.CMDialog1.FileName
Myfile = FrmMDI.CMDialog1.FileName
Z = InStr(1, Myfile, "\", 1)
Do While Z <> 0
Myfile = Mid(Myfile, Z + 1)
Z = InStr(1, Myfile, "\", 1)
Loop
If Myfile <> "multiratetable.exe" Then GoTo line_100
ReturnValue = Shell(mydata.path, 1) '运行设置程序
If ReturnValue <> "" Then
AppActivate ReturnValue ' 激活设置程序
Else
line_100:
mydata.path = ""
Err.Number = 100
OnErrStatement ("运行兼容功能程序")
End If
ErrHandler: ' 用户按了“取消”按钮
Exit Sub
End If
End Sub
Private Sub NO_BRAUD_Click()
frm_set.Show
frm_set.SetFocus
End Sub
Private Sub READ_DATA_Click()
frm_readdata.Show
frm_readdata.SetFocus
End Sub
Private Sub READ_STATUE_Click()
Frm_readstat.Show
Frm_readstat.SetFocus
End Sub
Private Sub Toolbar1_ButtonClick(ByVal TButton As Button)
Select Case TButton
Case "读状态 "
If end_s Then
Frm_readstat.Show
Frm_readstat.SetFocus
End If
Case "读电量 "
If end_s Then
frm_readdata.Show
frm_readdata.SetFocus
End If
End Select
End Sub
Private Sub mnuOptions_Click()
' 切换选中的选项与 .Visible 属性相匹配。
mnuOptionsToolbar.Checked = Toolbar1.Visible
End Sub
Private Sub mnuOptionsToolbar_Click()
' 切换工具栏的 visible 属性。
Toolbar1.Visible = Not Toolbar1.Visible
' 更改选定来适合当前状态。
mnuOptionsToolbar.Checked = Toolbar1.Visible
' 调用重新调整大小过程。
End Sub
Private Sub mnuWindowArrange_Click()
' 对任何已经最小化的子窗体排列图标。
FrmMDI.Arrange vbArrangeIcons
End Sub
Private Sub mnuWindowCascade_Click()
' 层叠子窗体。
FrmMDI.Arrange vbCascade
End Sub
Private Sub mnuWindowTile_Click()
' 平铺子窗体。
FrmMDI.Arrange vbTileHorizontal
End Sub
Private Sub Timer1_Timer()
With StatusBar1.Panels
.item(8).Text = Time$
.item(6).Text = Date$
.item(7).Text = myweekday
End With
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -