📄 dtp.bas
字号:
Attribute VB_Name = "DTP"
Option Explicit
Type EVENT_SET_INFO
dwWorkMode As Long
lpHandlerParam As Long
dwOutCondition As Long
dwOutParamVal As Long
dwUser As Long
End Type
Public Declare Function SsmSetEvent Lib "SHP_A3.dll" (ByVal wEvent As Integer, _
ByVal nReference As Integer, _
ByVal bEnable As Boolean, _
ByVal pEventSet As Long) As Integer
Public Declare Function SpyGetCallInCh Lib "SHP_A3.dll" (ByVal nCic As Integer) As Integer
Public Declare Function SpyGetCallOutCh Lib "SHP_A3.dll" (ByVal nCic As Integer) As Integer
Public Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" _
(ByVal lpPrevWndFunc As Long, _
ByVal hwnd As Long, ByVal Msg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
(ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Public Const GWL_WNDPROC = -4
Public Type CIC_STRUCT
nCicState As Integer 'State of monitored circuits
szCallerId As String * 20 'ENG:Calling party number
szCalleeId As String * 20 'Called party number
szCallInDtmf As String 'DTMF received on the incoming channel
szCallOutDtmf As String 'DTMF received on the outgoing channel
wRecDirection As Integer 'Recording direction
nCallInCh As Integer 'Incoming channel
nCallOutCh As Integer 'Outgoing channel
End Type
Const CIRCUIT_IDLE = 0 'Idle state
Const CIRCUIT_RCV_PHONUM = 1 'State of receiving phone number
Const CIRCUIT_RINGING = 2 'State of ringing
Const CIRCUIT_TALKING = 3 'State of talking
Public Const CALL_IN_RECORD = 0 'Incoming call recording
Public Const CALL_OUT_RECORD = 1 'Outgoing call recording
Public Const MIX_RECORD = 2 'Mix-record of incoming/outgoing call
Public Const S_SPY_STANDBY = 0 'Monitor: Idle
Public Const S_SPY_RCVPHONUM = 105 'Monitor: Receiving phone number
Public Const S_SPY_RINGING = 2 'Monitor: Ringing
Public Const S_SPY_TALKING = 3 'Monitor: Talking
Public CicState(0 To 1000) As CIC_STRUCT
Public nMaxCic As Integer 'Maximum number of the monitored circuits
Public lpPrevWndProc As Long
Public gHW As Long
Public m_nRecFormat As Integer '0-Incoming call recording 1-Outgoning call recording
'2-Mix-record of incoming/outgoing call
Public m_nCallFnMode As Integer '0-Call the function with circuit number as its parameter
'1-Call the function with channel number as its parameter
Const WM_USER = &H400
Const E_CHG_SpyState = &H31
Const E_CHG_RcvDTMF = &HC
'Initialize board
Function InitCtiBoard() As Boolean
Dim ErrMsg As String * 260
Dim szConfig As String * 260
Dim szIndex As String * 260
Dim i As Integer
szConfig = App.Path + "\ShConfig.ini" + Chr(0)
szIndex = App.Path + "\ShIndex.ini" + Chr(0)
'Load configuration file and initialize system
If (SsmStartCti(szConfig, szIndex) <> 0) Then
SsmGetLastErrMsg (ErrMsg) 'Get error message
MsgBox (ErrMsg)
InitCtiBoard = False
Else
'Judge if the number of initialized boards is the same as
' that of boards specified in the configuration file
If (SsmGetMaxUsableBoard() <> SsmGetMaxCfgBoard()) Then
SsmGetLastErrMsg (ErrMsg) ' Get error message
MsgBox (ErrMsg)
InitCtiBoard = False
Else
'Get the maximum number of the monitored circuits
nMaxCic = SpyGetMaxCic()
If (nMaxCic = -1) Then
MsgBox ("Fail to call SpyGetMaxCic")
End If
For i = 0 To nMaxCic - 1
CicState(i).szCallInDtmf = ""
CicState(i).szCallOutDtmf = ""
CicState(i).szCallerId = ""
CicState(i).szCalleeId = ""
CicState(i).nCicState = CIRCUIT_IDLE
CicState(i).wRecDirection = MIX_RECORD 'Mix-record
CicState(i).nCallInCh = -1
CicState(i).nCallOutCh = -1
Next i
InitCtiBoard = True
End If
End If
End Function
Public Sub InitCircuitListCtrl()
Dim i%
Form_DTP.CicGrid.Cols = 6
Form_DTP.CicGrid.Row = 0
Form_DTP.CicGrid.Col = 0
Form_DTP.CicGrid.Text = "Cic"
Form_DTP.CicGrid.Col = 1
Form_DTP.CicGrid.Text = "CicState"
Form_DTP.CicGrid.Col = 2
Form_DTP.CicGrid.Text = "CallerId"
Form_DTP.CicGrid.Col = 3
Form_DTP.CicGrid.Text = "CalleeId"
Form_DTP.CicGrid.Col = 4
Form_DTP.CicGrid.Text = "IncomingCh:DTMF"
Form_DTP.CicGrid.Col = 5
Form_DTP.CicGrid.Text = "OutgoingCh:DTMF"
Form_DTP.CicGrid.ColWidth(0) = 40 * 12
Form_DTP.CicGrid.ColWidth(1) = 100 * 12
Form_DTP.CicGrid.ColWidth(2) = 100 * 12
Form_DTP.CicGrid.ColWidth(3) = 100 * 12
Form_DTP.CicGrid.ColWidth(4) = 200 * 12
Form_DTP.CicGrid.ColWidth(5) = 200 * 12
Form_DTP.CicGrid.Rows = 1
For i = 0 To nMaxCic - 1
Form_DTP.CicGrid.AddItem (Str(i))
Next i
End Sub
Public Sub UpdateCircuitListCtrl()
Dim szNewStat As String * 100
Dim szOldStat As String * 100
Dim i As Integer
Dim nIndex%
nIndex = 0
For i = 0 To nMaxCic - 1
Select Case (CicState(i).nCicState)
Case CIRCUIT_IDLE
szNewStat = "Idle"
Case CIRCUIT_RCV_PHONUM
szNewStat = "Receiving Phone number"
Case CIRCUIT_RINGING
szNewStat = "Ringing"
Case CIRCUIT_TALKING
szNewStat = "Talking"
End Select
szOldStat = Form_DTP.CicGrid.TextMatrix(nIndex + 1, 1)
If (szOldStat <> szNewStat) Then
Form_DTP.CicGrid.TextMatrix(nIndex + 1, 1) = szNewStat
End If
szOldStat = Form_DTP.CicGrid.TextMatrix(nIndex + 1, 2)
If (szOldStat <> CicState(i).szCallerId) Then
Form_DTP.CicGrid.TextMatrix(nIndex + 1, 2) = CicState(i).szCallerId
End If
szOldStat = Form_DTP.CicGrid.TextMatrix(nIndex + 1, 3)
If (szOldStat <> CicState(i).szCalleeId) Then
Form_DTP.CicGrid.TextMatrix(nIndex + 1, 3) = CicState(i).szCalleeId
End If
szNewStat = Str(CicState(i).nCallInCh) + ":" + CicState(i).szCallInDtmf
szOldStat = Form_DTP.CicGrid.TextMatrix(nIndex + 1, 4)
If (szOldStat <> szNewStat) Then
Form_DTP.CicGrid.TextMatrix(nIndex + 1, 4) = szNewStat
End If
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -