⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mdiform1.frm

📁 基于VC++串口编程。经过好长时间的寻找
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
Begin VB.MDIForm MDIForm1 
   BackColor       =   &H8000000C&
   Caption         =   "远程水文监测系统"
   ClientHeight    =   5370
   ClientLeft      =   315
   ClientTop       =   885
   ClientWidth     =   11310
   LinkTopic       =   "MDIForm1"
   WindowState     =   2  'Maximized
   Begin MSComctlLib.ImageList ImageList1 
      Left            =   3720
      Top             =   1440
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   16
      ImageHeight     =   16
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   5
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "MDIForm1.frx":0000
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "MDIForm1.frx":0452
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "MDIForm1.frx":08A4
            Key             =   ""
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "MDIForm1.frx":0CF6
            Key             =   ""
         EndProperty
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "MDIForm1.frx":1B48
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.StatusBar StatusBar1 
      Align           =   2  'Align Bottom
      Height          =   375
      Left            =   0
      TabIndex        =   0
      Top             =   4995
      Width           =   11310
      _ExtentX        =   19950
      _ExtentY        =   661
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   4
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            AutoSize        =   1
            Enabled         =   0   'False
            Object.Width           =   11748
            Text            =   "远程水文监测系统"
            TextSave        =   "远程水文监测系统"
         EndProperty
         BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Style           =   6
            TextSave        =   "2002-11-1"
         EndProperty
         BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Style           =   5
            TextSave        =   "19:33"
         EndProperty
         BeginProperty Panel4 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Style           =   1
            Enabled         =   0   'False
            TextSave        =   "CAPS"
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.Toolbar Toolbar1 
      Align           =   1  'Align Top
      Height          =   570
      Left            =   0
      TabIndex        =   1
      Top             =   0
      Width           =   11310
      _ExtentX        =   19950
      _ExtentY        =   1005
      ButtonWidth     =   1773
      ButtonHeight    =   953
      Wrappable       =   0   'False
      Appearance      =   1
      Style           =   1
      ImageList       =   "ImageList1"
      _Version        =   393216
      BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
         NumButtons      =   8
         BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "自动接收"
            Key             =   "AutoRec"
            ImageIndex      =   1
         EndProperty
         BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   4
         EndProperty
         BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "数据请求"
            Key             =   "DataAsk"
            ImageIndex      =   3
         EndProperty
         BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   4
         EndProperty
         BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "查询与显示"
            Key             =   "DataQuery"
            ImageIndex      =   4
         EndProperty
         BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   3
         EndProperty
         BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "退出系统"
            Key             =   "Exit"
            ImageIndex      =   5
         EndProperty
         BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   3
         EndProperty
      EndProperty
      BorderStyle     =   1
      Begin MSCommLib.MSComm Comm1 
         Left            =   6480
         Top             =   0
         _ExtentX        =   1005
         _ExtentY        =   1005
         _Version        =   393216
         DTREnable       =   -1  'True
      End
      Begin MSComDlg.CommonDialog Dialog 
         Left            =   7200
         Top             =   120
         _ExtentX        =   847
         _ExtentY        =   847
         _Version        =   393216
      End
      Begin VB.Timer Timer1 
         Enabled         =   0   'False
         Interval        =   650
         Left            =   7680
         Top             =   0
      End
   End
   Begin VB.Menu ParaSetting 
      Caption         =   "系统参数设定(&P)"
      Begin VB.Menu StateNo 
         Caption         =   "状态码设定(&S)"
      End
      Begin VB.Menu io 
         Caption         =   "I/O值设定(&I)"
      End
      Begin VB.Menu shezhi 
         Caption         =   "电流最大值设定(&M)"
      End
      Begin VB.Menu aa 
         Caption         =   "-"
      End
      Begin VB.Menu exit 
         Caption         =   "退出(&E)"
      End
   End
   Begin VB.Menu jiance 
      Caption         =   "数据检测(&D)"
      Begin VB.Menu AutoRecData 
         Caption         =   "自动接收数据(&R)"
      End
      Begin VB.Menu DataAsk 
         Caption         =   "请求数据(&A)"
      End
   End
   Begin VB.Menu DBManage 
      Caption         =   "数据库管理与查询(&M)"
      Begin VB.Menu DataQuery 
         Caption         =   "数据查询(&Q)"
      End
      Begin VB.Menu DataBackup 
         Caption         =   "数据备份(&B)"
      End
      Begin VB.Menu DataRestore 
         Caption         =   "数据恢复(&R)"
      End
   End
   Begin VB.Menu help 
      Caption         =   "帮助(&H)"
      Begin VB.Menu about 
         Caption         =   "关于(&A)"
      End
   End
End
Attribute VB_Name = "MDIForm1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub about_Click()
frmAbout.Show
End Sub

Private Sub AutoRecData_Click()
Frmzhenting.Show
End Sub

Private Sub DataAsk_Click()
 Frmqingqiu.Show
End Sub

Private Sub DataBackup_Click()
 On Error GoTo err
     Dialog.filename = ""     'Dialog控件的filename属性设置文件的名称
    Dialog.Filter = "MDB files (*.mdb) |*.mdb|"       '设置文件的类型
    Dialog.ShowSave                     '设置弹出窗口的类型,这里是保存文件的类型
    If Dialog.Flags <> 0 Then              '判断用户的选择,为0,代表取消备份
        If Dialog.filename <> "" Then
        If FileLen(App.Path & "\db\db1.MDB") > 1210000 Then
            MsgBox "数据库文件过大!", vbOKOnly, "通知"    '判断数据库文件是否过大
        Else
            FileCopy App.Path & "\db\db1.MDB", Dialog.filename
                                                '按照选择的路径,把数据库文件复制过去
             MsgBox "备份已经完成", vbOKOnly, "通知"
        End If
     End If
     End If
    Exit Sub
  
err:
             MsgBox "对不起,备份出错!请关掉所有子窗口重试!", vbOKOnly, "通知"
End Sub

Private Sub DataQuery_Click()

Frmchaxun.Show
End Sub

Private Sub DataRestore_Click()
 On Error GoTo err
    Dialog.filename = ""                    'Dialog控件的filename属性设置文件的名称
    Dialog.Filter = "MDB files (*.mdb) |*.mdb|"     '设置文件的类型
    Dialog.ShowOpen                              '设置弹出窗口的类型,这里是保存文件的类型
    If Dialog.Flags <> 0 Then                       '判断用户的选择,为0,代表取消备份
    If Dialog.filename <> "" Then
        If FileLen(App.Path & "\db\db1.MDB") > 1210000 Then
            MsgBox "数据库文件过大!", vbOKOnly, "通知"  ' '判断数据库文件是否过大
        Else
            FileCopy Dialog.filename, App.Path & "\db\db1.MDB"
                                             '按照选择的路径,把数据库文件复制过去
             MsgBox "导入已经完成", vbOKOnly, "通知"
        End If
    End If
    End If
    Exit Sub
    
err:
   MsgBox "对不起,导入出错!请关掉所有子窗口重试!", vbOKOnly, "通知"
End Sub



Private Sub exit_Click()
Unload Me
End
End Sub



Private Sub io_Click()
Frmstate.Show
End Sub





Private Sub MDIForm_Load()
If Comm1.PortOpen = False Then
Comm1.CommPort = portitem         '设置端口号
Comm1.PortOpen = True             '打开端口
Comm1.Output = "AT+CNMI=1,1,0,0,1" + Chr(13) + Chr(10)  '设置新消息指示方式,以回车和换行
                                                        ' 符结束
Timer1.Enabled = True               '触发计时器
End If

End Sub

Private Sub MDIForm_Unload(Cancel As Integer)
Unload Me
End Sub

Private Sub shezhi_Click()
Frmliumax.Show
End Sub

Private Sub StateNo_Click()

Frmstateno.Show
End Sub

Private Sub Timer1_Timer()
Dim Buf$
If Comm1.InBufferCount > 0 Then
  Comm1.InputLen = 0
  Buf = Comm1.Input
  Timer1.Enabled = False
End If
End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
On Error Resume Next

Select Case Button.Key

Case "DataRec"
 Frmzhenting.Show
Case "DataAsk"
 Frmqingqiu.Show
Case "DataQuery"
Frmchaxun.Show
Case "Exit"
  Unload Me
End Select
End Sub



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -