用VB实现来电显示的源代码(部份)[2]

[入库:2006年2月23日] [更新:2007年3月24日]

本文简介:

'串行口接收事件处理
Private Sub MSComm1_OnComm()
    Dim a
    Dim b
    On Error GoTo why
    Dim inStrData As String, tm As String
    Dim iPos As Integer
    inStrData = MSComm1.Input & MSComm1.Input
    iPos = InStr(inStrData, "NMBR=")
    '记录程序是否第一次打开,不是话下次就不显示猫的返回信息
    
     If TimeOpen = 0 Then
         MsgBox inStrData
         TimeOpen = 54 '写成什么都可以,但0不可以,
         MsgBox "恭喜!来电显示和Modem都已经成功设置." '成功了,哈哈,我有钱可以赚了
         frmWelcome.Visible = False
         Command2.Visible = False
     End If
    a = InStr(1, inStrData, "NMBR = ", vbTextCompare)
    If a <> 0 Then
        b = InStr(a, inStrData, vbCr, vbTextCompare)
        PhoneNumber = Mid(inStrData, 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.CommPort = COMX

    If Not MSComm1.PortOpen Then MSComm1.PortOpen = True

    MSComm1.Output = "AT+VCID=1" + vbCr

    '检查Modem命令是否完成

    Call CHK_MODEM

    MSComm1.Output = "ATS0=0" + vbCr
    Exit Sub
why:
MsgBox Err.Description

End Sub

本文关键:用VB实现来电显示的源代码(部份)
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top