Source code used to display incoming calls when managing information systems.
Option explicit
Const debflg = 1
Public comx, beepno, hangup, pnloc as integer
Public combuf, comlin as string
Dim H
Private sub commandementclick ()
Frmwelcome. Visible = false
End sub
Private sub option#click (index as integer)
Comx = index + 1
Call init_modem
End sub
Private sub form_load ()
'The phone number is blank
Phonenumber = "" 'is used to store phone numbers from cats
Getnumber = "" 'stores the number after removing the area code.
With mscomm1
. Inbuffersize = 1024
. Inputlen = 0
. Inputmode = 0
. Rthreshold = 1
. Rtsenable = true
. Settings = "9600, N, 8, 1"
. Sthreshold = 0
End
'Check the serial port
Dim I, C as integer
Comx = 0
Combuf = ""
Comlin = ""
Beepno = 0
Hangup = 0
On Error goto error_form_load
'Detect available serial ports
For c = 1 to 4
If mscomm1.portopen then mscomm1.portopen = false
Mscomm1.commp ORT = C
If not mscomm1.portopen then
Mscomm1.portopen = true
End if
If mscomm1.portopen then mscomm1.portopen = false
If comx = 0 then comx = C
Form_load_1:
Next C
If comx = 0 then end
On Error goto 0
Option1 (comx-1). value = true
Exit sub
Error_form_load:
Option1 (c-1). Enabled = false
Resume form_load_1
Exit sub
Exit sub
Why:
Msgbox err. Description
End sub
'Check the serial port
'Check whether the modem command is complete
Private sub chk_modem ()
On Error goto why
Dim t as single
Dim L as integer
T = Timer
Do
Combuf = combuf + mscomm1.input
L = instr (1, combuf, "OK ")
Loop until l <> 0 or timer-T> 1
If l = 0 then
No modem found on msgbox "Port" & comx & ". Try another port.", vbokonly + vbcritical, "test modem"
Else
Msgbox "the incoming call display has been started. After confirming this button, if OK is returned, the computer and modem can communicate normally. Otherwise, try another port"
End if
Exit sub
Why: msgbox err. Description
End sub
'Processing of serial port receiving events
Private sub mscomm1_oncomm ()
Dim
Dim B
On Error goto why
Dim metric data as string, TM as string
Dim IPOs as integer
Export data = mscomm1.input & mscomm1.input
IPOs = instr (metric data, "nmbr = ")
'Record whether the program is opened for the first time. If not, the cat's return information will not be displayed next time.
If timeopen = 0 then
Msgbox upload data
Timeopen = 54 'can write everything, but 0 cannot,
Msgbox "Congratulations! Both the incoming call display and modem are successfully set. "'It's successful. Haha, I can make money if I have money.
Frmwelcome. Visible = false
Command2.visible = false
End if
A = instr (1, using data, "nmbr =", vbtextcompare)
If a <> 0 then
B = instr (A, using data, vbcr, vbtextcompare)
Phonenumber = mid (customized data, A + 7, B-a-7)
Frmreg. Show
Else:
End if
Exit sub
Why:
Msgbox err. Description
End sub
Private sub init_modem ()
On Error goto why
If mscomm1.portopen then mscomm1.portopen = false
Mscomm1.commp ORT = comx
If not mscomm1.portopen then mscomm1.portopen = true
Mscomm1.output = "at + vcid = 1" + vbcr
'Check whether the modem command is complete
Call chk_modem
Mscomm1.output = "ats0 = 0" + vbcr
Exit sub
Why:
Msgbox err. Description
End sub
= 2 ================================================ ========================================================== ======
Option explicit
Const debflg = 1
Public comx, beepno, hangup, pnloc as integer
Public combuf, comlin as string
Dim H
Private sub commandementclick ()
Frmwelcome. Visible = false
End sub
Private sub option#click (index as integer)
Comx = index + 1
Call init_modem
End sub
Private sub form_load ()
'The phone number is blank
Phonenumber = "" 'is used to store phone numbers from cats
Getnumber = "" 'stores the number after removing the area code.
With mscomm1
. Inbuffersize = 1024
. Inputlen = 0
. Inputmode = 0
. Rthreshold = 1
. Rtsenable = true
. Settings = "9600, N, 8, 1"
. Sthreshold = 0
End
'Check the serial port
Dim I, C as integer
Comx = 0
Combuf = ""
Comlin = ""
Beepno = 0
Hangup = 0
On Error goto error_form_load
'Detect available serial ports
For c = 1 to 4
If mscomm1.portopen then mscomm1.portopen = false
Mscomm1.commp ORT = C
If not mscomm1.portopen then
Mscomm1.portopen = true
End if
If mscomm1.portopen then mscomm1.portopen = false
If comx = 0 then comx = C
Form_load_1:
Next C
If comx = 0 then end
On Error goto 0
Option1 (comx-1). value = true
Exit sub
Error_form_load:
Option1 (c-1). Enabled = false
Resume form_load_1
Exit sub
Exit sub
Why:
Msgbox err. Description
End sub
'Check the serial port
'Check whether the modem command is complete
Private sub chk_modem ()
On Error goto why
Dim t as single
Dim L as integer
T = Timer
Do
Combuf = combuf + mscomm1.input
L = instr (1, combuf, "OK ")
Loop until l <> 0 or timer-T> 1
If l = 0 then
No modem found on msgbox "Port" & comx & ". Try another port.", vbokonly + vbcritical, "test modem"
Else
Msgbox "the incoming call display has been started. After confirming this button, if OK is returned, the computer and modem can communicate normally. Otherwise, try another port"
End if
Exit sub
Why: msgbox err. Description
End sub
'Processing of serial port receiving events
Private sub mscomm1_oncomm ()
Dim
Dim B
On Error goto why
Dim metric data as string, TM as string
Dim IPOs as integer
Export data = mscomm1.input & mscomm1.input
IPOs = instr (metric data, "nmbr = ")
'Record whether the program is opened for the first time. If not, the cat's return information will not be displayed next time.
If timeopen = 0 then
Msgbox upload data
Timeopen = 54 'can write everything, but 0 cannot,
Msgbox "Congratulations! Both the incoming call display and modem are successfully set. "'It's successful. Haha, I can make money if I have money.
Frmwelcome. Visible = false
Command2.visible = false
End if
A = instr (1, using data, "nmbr =", vbtextcompare)
If a <> 0 then
B = instr (A, using data, vbcr, vbtextcompare)
Phonenumber = mid (customized data, A + 7, B-a-7)
Frmreg. Show
Else:
End if
Exit sub
Why:
Msgbox err. Description
End sub
Private sub init_modem ()
On Error goto why
If mscomm1.portopen then mscomm1.portopen = false
Mscomm1.commp ORT = comx
If not mscomm1.portopen then mscomm1.portopen = true
Mscomm1.output = "at + vcid = 1" + vbcr
'Check whether the modem command is complete
Call chk_modem
Mscomm1.output = "ats0 = 0" + vbcr
Exit sub
Why:
Msgbox err. Description
End sub
Http://topic.csdn.net/t/20031205/23/2533209.html
Http://topic.csdn.net/t/20060802/16/4922488.html
Http://topic.csdn.net/t/20040407/23/2938498.html