Public data_array
Private Sub splict_line(xxx As String, j As Integer)
Dim k As Integer
Dim bb
bb = Split(xxx, ",")
For k = 0 To UBound(bb)
data_array(j, k) = bb(k)
Next
End SubPrivate Sub read_txtfile(fname As String)
Dim linestr As String
Dim i As Integer
Dim fso, ra, getline
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FileExists(fname)) Then
Set ff = fso.OpenTextFile(fname, 1, 0)
ra = ff.ReadAll
getline = ff.Line - 1
ff.Close
' sleep 1000
ReDim data_array(getline - 1, 10)
Set ff = fso.OpenTextFile("c:\data.txt", 1, 0)
For i = 0 To getline - 1
linestr = Trim(CStr(ff.ReadLine()))
Call splict_line(linestr, i)
Next i
ff.Close
End If
Set fso = Nothing
End SubPrivate Sub Command1_Click()
Call read_txtfile("c:\data.txt")
End Sub
Public Function get_TrunkChState11(Optional ch_no As Integer = -1) '中继通道检测
Dim state As String
Dim ii As Integer
Dim tc()
get_TrunkChState11 = ""
If ch_no <> -1 Then
If ch_no > nTotalCh Then Exit Function
get_TrunkChState11 = get_TrunkChState00(ch_no)
Exit Function
End If
ReDim tc(nTotalCh - 1, 1)
For ii = 0 To nTotalCh - 1
If ChInfo(ii).EnCalled = True Then
Select Case (ChInfo(ii).InUse)
Case 0
state = "空闲"
Case 1
state = "拨号"
Case 2
state = "等待摘机"
Case 3
state = "摘机"
Case 4
state = "摘机通话"
Case 5
state = "挂机"
Case 97
state = "无人接听"
Case 96
state = "外线占线"
Case 95
state = "外线被振铃"
End Select
tc(ii, 0) = state
Call SsmGetDtmfStr(ii, ChInfo(ii).DtmfBuf)
tc(ii, 1) = ChInfo(ii).DtmfBuf
End If
Next ii
get_TrunkChState11 = tc
End Function
Dim state As String
Dim d As Integer
Dim TheIndex As Integer
Dim nindex As Integer
Dim tcs As Variant
tcs = get_TrunkChState11()
nindex = 0
For d = 0 To nTotalCh - 1
If ChInfo(d).EnCalled = True Then
TheIndex = Form_control.TrkChGrid.Cols * (nindex + 1) + 1
If Form_control.TrkChGrid.TextArray(TheIndex) <> tcs(d, 0) Then Form_control.TrkChGrid.TextArray(TheIndex) = tcs(d, 0)
TheIndex = TheIndex + 1
If Form_control.TrkChGrid.TextArray(TheIndex) <> tcs(d, 1) Then Form_control.TrkChGrid.TextArray(TheIndex) = tcs(d, 1)
nindex = nindex + 1
End If
Next d
End Sub