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

📄 frmmain.frm

📁 来电显示客户管理系统 TAPI 应用MSComm控件
💻 FRM
📖 第 1 页 / 共 2 页
字号:
            Picture         =   "FrmMain.frx":15B4
            Key             =   ""
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "FrmMain.frx":1E8E
            Key             =   ""
         EndProperty
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "FrmMain.frx":2768
            Key             =   ""
         EndProperty
         BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "FrmMain.frx":3442
            Key             =   ""
         EndProperty
         BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "FrmMain.frx":3D1C
            Key             =   ""
         EndProperty
         BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "FrmMain.frx":45F6
            Key             =   ""
         EndProperty
         BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "FrmMain.frx":4ED0
            Key             =   ""
         EndProperty
         BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "FrmMain.frx":57AA
            Key             =   ""
         EndProperty
         BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "FrmMain.frx":6084
            Key             =   ""
         EndProperty
         BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "FrmMain.frx":695E
            Key             =   ""
         EndProperty
         BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "FrmMain.frx":7638
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.Toolbar Toolbar 
      Align           =   1  'Align Top
      Height          =   855
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   13545
      _ExtentX        =   23892
      _ExtentY        =   1508
      ButtonWidth     =   2090
      ButtonHeight    =   1349
      Appearance      =   1
      ImageList       =   "ImageBar"
      _Version        =   393216
      BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
         NumButtons      =   9
         BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "开启来电显示"
            Key             =   "来电显示"
            ImageIndex      =   2
         EndProperty
         BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   3
         EndProperty
         BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "客户组管理"
            ImageIndex      =   1
         EndProperty
         BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "客户管理"
            ImageIndex      =   3
         EndProperty
         BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   3
         EndProperty
         BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "来电记录查询"
            ImageIndex      =   11
         EndProperty
         BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "其他信息查询"
            ImageIndex      =   7
         EndProperty
         BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   3
         EndProperty
         BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "退出"
            ImageIndex      =   12
         EndProperty
      EndProperty
      Begin MSCommLib.MSComm MSComm1 
         Left            =   8040
         Top             =   120
         _ExtentX        =   1005
         _ExtentY        =   1005
         _Version        =   393216
         DTREnable       =   -1  'True
      End
   End
   Begin MSComctlLib.TreeView TreeView1 
      Height          =   4575
      Left            =   120
      TabIndex        =   1
      Top             =   960
      Width           =   2415
      _ExtentX        =   4260
      _ExtentY        =   8070
      _Version        =   393217
      HideSelection   =   0   'False
      Indentation     =   353
      LabelEdit       =   1
      Sorted          =   -1  'True
      Style           =   7
      HotTracking     =   -1  'True
      SingleSel       =   -1  'True
      ImageList       =   "ImageList1"
      BorderStyle     =   1
      Appearance      =   1
      MousePointer    =   99
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      MouseIcon       =   "FrmMain.frx":90FA
   End
   Begin MSComctlLib.StatusBar StatusBar 
      Align           =   2  'Align Bottom
      Height          =   375
      Left            =   0
      TabIndex        =   3
      Top             =   8565
      Width           =   13545
      _ExtentX        =   23892
      _ExtentY        =   661
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   2
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Style           =   6
            Alignment       =   2
            Object.Width           =   21080
            MinWidth        =   21080
            TextSave        =   "2005-7-21"
         EndProperty
         BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Style           =   5
            Alignment       =   2
            TextSave        =   "8:58"
         EndProperty
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      OLEDropMode     =   1
   End
   Begin MSComctlLib.ImageList ImageList1 
      Left            =   0
      Top             =   0
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483628
      ImageWidth      =   16
      ImageHeight     =   16
      MaskColor       =   16777215
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   5
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "FrmMain.frx":9414
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "FrmMain.frx":BDA6
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "FrmMain.frx":E738
            Key             =   ""
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "FrmMain.frx":110CA
            Key             =   ""
         EndProperty
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "FrmMain.frx":13A5C
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "最近来电信息:"
      Height          =   195
      Left            =   120
      TabIndex        =   5
      Top             =   5760
      Width           =   1260
   End
End
Attribute VB_Name = "FrmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()

Dim ConnIni As String

    ConnIni = GetAppPath & "\Setup.ini"
    
Server = ReadOneString("setup", "Server", ConnIni)
User = ReadOneString("setup", "User", ConnIni)
Password = ReadOneString("setup", "Password", ConnIni)


  Adodc2.ConnectionString = "driver={SQL Server};server=" + Trim(Server) + ";uid=" + Trim(User) + ";pwd=" + Trim(Password) + ";database=CallerMIS"
  Adodc2.RecordSource = "SELECT * FROM Caller order by CallerId"
  Adodc2.Refresh
  
  Set DataGrid2.DataSource = Adodc2
  
  

Set TmpNode = TreeView1.Nodes.Add(, , "a0", "客户组信息", 1, 3)
  TmpNode.Selected = True
  TmpNode.ExpandedImage = 2
  Call Add_DepToTree(TreeView1, "a0")
  TreeView1_Click
  


On Error GoTo error_open
For i = 1 To 4
FrmMain.MSComm1.CommPort = i
FrmMain.MSComm1.PortOpen = True
'设置可用的第一个串口
On Error GoTo 0
FrmMain.MSComm1.PortOpen = False
Exit Sub
error_resume:
Next


error_open:
Resume error_resume

  
   
End Sub



Private Sub MSComm1_OnComm()
On Error Resume Next
    Static buffer As String
    Dim ring As String
    Dim PosDate As String, Postime As String, Posnum As String
    buffer = buffer + MSComm1.Input


If InStr(1, buffer, "NMBR") Then
        Me.WindowState = 2
        PosDate = InStr(1, buffer, "DATE")
        Postime = InStr(1, buffer, "TIME")
        Posnum = InStr(1, buffer, "NMBR")
    If Posnum Then
        FrmCaller.CallDate = Mid(buffer, Postime + 7, 4)
        FrmCaller.CallTime = Mid(buffer, PosDate + 7, 4)
        FrmCaller.Callnum = Mid(buffer, Posnum + 7, (Len(buffer) - 8 - Posnum))
        FrmCaller.Show
        buffer = ""
    End If
End If


'    '测试
'    FrmCaller.CallDate = "0720"
'    FrmCaller.CallTime = "1438"
'    FrmCaller.Callnum = "01051683640"
'    FrmCaller.Show
'    buffer = ""


     End Sub


Private Sub Toolbar_ButtonClick(ByVal Button As MSComctlLib.Button)
    Select Case Button.Caption
        Case "客户组管理"
            FrmClientGroup.Show 1
                Set TmpNode = TreeView1.Nodes.Add(, , "a0", "客户组信息", 1, 3)
                TmpNode.Selected = True
                TmpNode.ExpandedImage = 2
                Call Add_DepToTree(TreeView1, "a0")
                TreeView1_Click
            
        Case "客户管理"
            FrmClient.Show
        Case "来电记录查询"
          FrmCallerInfo.Show
        Case "其他信息查询"
           FrmOtherInfo.Show
        Case "开启来电显示"
            If Not ShowNumber(True) Then
            MsgBox "不能开启来电显示功能", vbCritical
            Else
            MsgBox "来电功能已开启!", vbInformation
            End If
            Toolbar.Buttons("来电显示").Caption = "关闭来电显示"
        Case "关闭来电显示"
            If Not ShowNumber(False) Then
            MsgBox "不能开启来电显示功能", vbCritical
            Else
            FrmMain.MSComm1.PortOpen = False
            MsgBox "来电显示功能已禁止!", vbInformation
            End If
            Toolbar.Buttons("来电显示").Caption = "开启来电显示"
        Case "退出"
            Unload Me
            End
    End Select
End Sub

Function ShowNumber(OpenClose As Boolean) As Boolean

   Dim i As Integer
   Dim strTemp As String
   Dim CommCID(1) As String
   
   Dim Duration As Single
   Dim BStop As Boolean
   Dim Ninterval As Integer
   
   If OpenClose = True Then
        FrmMain.MSComm1.PortOpen = True
        
   End If
   
   CommCID(0) = "at#id=" & Str(IIf(OpenClose, 1, 0))
   CommCID(1) = "at#vcid=" & IIf(OpenClose, 1, 0)
   FrmMain.MSComm1.RThreshold = 0
   For i = 0 To 1
          FrmMain.MSComm1.Output = CommCID(i) & vbCr
          Duration = Timer + 100
          Do While BStop = False
              Ninterval = Ninterval + 1
              If FrmMain.MSComm1.InBufferCount >= 2 Then
                  strTemp = FrmMain.MSComm1.Input
                  If InStr(strTemp, "OK") = 0 Then
                      BStop = True
                      ShowNumber = True
                      Exit Function
                  End If
               End If
               If Timer >= Duration Or Err.Number Then Exit Do
               Loop
    Next i
    ShowNumber = False
    FrmMain.MSComm1.RThreshold = 1
               
End Function

Private Sub TreeView1_Click()
  Dim Focuskey As String
  '根据关键字获取部门信息
  Focuskey = TreeView1.SelectedItem.Key
  CurDep.Dep_name = TreeView1.SelectedItem.Text
  CurDep.Dep_Id = Val(Right(TreeView1.SelectedItem.Key, Len(TreeView1.SelectedItem.Key) - 1))
  
  '如果包含子结点,则设置图像格式
  If CurDep.HaveSon(CurDep.Dep_Id) = False Then
    TreeView1.SelectedItem.ExpandedImage = 4
    TreeView1.SelectedItem.Image = 4
    TreeView1.SelectedItem.SelectedImage = 5
  End If


  '根据选择的部门编号刷新Ado,从而选择符合条件的员工姓名
  
  Adodc1.ConnectionString = "driver={SQL Server};server=" + Trim(Server) + ";uid=" + Trim(User) + ";pwd=" + Trim(Password) + ";database=CallerMIS"
  Adodc1.RecordSource = "SELECT * FROM Client WHERE ClientGroup =" + Trim(Str(CurDep.Dep_Id))
  Adodc1.Refresh
  
  Set DataGrid1.DataSource = Adodc1

End Sub

















⌨️ 快捷键说明

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