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

📄 main.frm

📁 用于小灵通CNGP协议下的通讯接口监控
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Main 
   BackColor       =   &H80000001&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "CSCC"
   ClientHeight    =   1515
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   7260
   Icon            =   "Main.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1515
   ScaleWidth      =   7260
   ShowInTaskbar   =   0   'False
   Begin VB.Timer Timer1 
      Interval        =   1000
      Left            =   1200
      Top             =   1140
   End
   Begin VB.Timer Timer2 
      Left            =   750
      Top             =   1140
   End
   Begin VB.TextBox Text2 
      Appearance      =   0  'Flat
      BackColor       =   &H80000007&
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000FF&
      Height          =   1515
      Left            =   0
      Locked          =   -1  'True
      MultiLine       =   -1  'True
      TabIndex        =   1
      Top             =   0
      Width           =   1665
   End
   Begin VB.TextBox Text1 
      Appearance      =   0  'Flat
      BackColor       =   &H80000004&
      Height          =   1755
      Left            =   1650
      MultiLine       =   -1  'True
      ScrollBars      =   1  'Horizontal
      TabIndex        =   0
      Top             =   0
      Width           =   5595
   End
End
Attribute VB_Name = "Main"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim conn As New ADODB.Connection
Dim comm As New ADODB.Command
Dim rs As New ADODB.Recordset
Dim inter

Private Sub Form_Activate()
    If App.PrevInstance Then
           MsgBox "CSCC已经运行!", , "SSCC"
           End
    End If
End Sub

Private Sub Form_Load()

    Open App.Path & "\config.ini" For Input As #1
    Line Input #1, ip
    Line Input #1, uid
    Line Input #1, pwd
    Line Input #1, dbname
    Line Input #1, inter
    Close #1
    Main.Top = Screen.Height - Main.Height - 400
    Main.Left = Screen.Width - Main.Width

    SetWindowPos Me.hwnd, hwnd_topmost, 0, 0, 0, 0, topmost_flags
    conn.ConnectionString = "driver=sql server;server=" & ip & ";uid=" & uid & ";pwd=" & pwd & ";database=" & dbname
    conn.Open
    comm.ActiveConnection = conn
    Timer2.Interval = Int(inter) * 1000
    Timer2.Enabled = True
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    Timer2.Enabled = False
    If rs.State <> 0 Then rs.Close
    Set rs = Nothing
    conn.Close
End Sub


Private Sub Timer2_Timer()
        Me.Caption = "CSCC <" & Time & ">      监控频率:次/" & inter & "秒"
        Text1.Text = "Wait Send Content:"
        comm.CommandText = "select top 6 msgcontent from cngp_transmitter where status='insert' order by Priority desc"
        Set rs = comm.Execute
        Do Until rs.EOF = True
            DoEvents
            Text1.Text = Text1.Text & vbCrLf & rs.Fields(0)
            rs.MoveNext
        Loop
        rs.Close

        comm.CommandText = "select count(*) from cngp_receiver where isreport=1"
        Set rs = comm.Execute
        Text2.Text = "状态报告: " & rs.Fields(0)
        a = rs.Fields(0)
        rs.Close
        comm.CommandText = "select count(*) from cngp_receiver"
        Set rs = comm.Execute
        Text2.Text = "上行信息: " & rs.Fields(0) - a & vbCrLf & Text2.Text
        rs.Close
        
        comm.CommandText = "select count(*) from cngp_Transmitter where status='insert'"
        Set rs = comm.Execute
        Text2.Text = "等待发送: " & rs.Fields(0) & vbCrLf & Text2.Text
        rs.Close
        comm.CommandText = "select count(*) from cngp_Transmitter where status='SUCCESS'"
        Set rs = comm.Execute
        Text2.Text = "提交成功: " & rs.Fields(0) & vbCrLf & Text2.Text
        rs.Close
        comm.CommandText = "select count(*) from cngp_Transmitter where status='waiting'"
        Set rs = comm.Execute
        Text2.Text = "等待确认: " & rs.Fields(0) & vbCrLf & Text2.Text
        rs.Close
        comm.CommandText = "select count(*) from cngp_Transmitter where status<>'SUCCESS' and status<>'insert' and status<>'WAITING'"
        Set rs = comm.Execute
        Text2.Text = "提交失败: " & rs.Fields(0) & vbCrLf & Text2.Text
        rs.Close
        Text2.Text = "Status:" & vbCrLf & Text2.Text
End Sub

⌨️ 快捷键说明

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