您现在所在的是:

串口通信

回帖:0个,阅读:11385 [上一页] [1] [下一页]
29673
思南 管理员
文章数:14047
年度积分:62
历史总积分:29673
注册时间:2001/3/12
发站内信
发表于:2001/8/18 7:44:00
#0楼
只用了tapiRequestMakeCall函数的简单程序,可以了解一下TAPI与直接用AT指令控制MODEM的区别。建立窗口,放置Command1,直接将代码粘贴到窗口CODE中就可以了。

Option Explicit
     Private Declare Function tapiRequestMakeCall Lib "tapi32.dll" _
        (ByVal stNumber As String, ByVal stDummy1 As String, _
        ByVal stDummy2 As String, ByVal stDummy3 As String) As Long
     Private Const ID_CANCEL = 2
     Private Const MB_OKCANCEL = 1
     Private Const MB_ICONSTOP = 16, MB_ICONINFORMATION = 64

     
     
     Function DialNumber(PhoneNumber)
        Dim Msg As String, MsgBoxType As Integer, MsgBoxTitle As String
        Dim RetVal As Long

        ' Ask the user to pick up the phone.
        Msg = "Please pickup the phone and click OK to dial " _
           & PhoneNumber
        MsgBoxType = MB_ICONINFORMATION + MB_OKCANCEL
        MsgBoxTitle = "Dial Number"

        If MsgBox(Msg, MsgBoxType, MsgBoxTitle) = ID_CANCEL Then
           Exit Function
        End If

        ' Send the telephone number to the modem.
        RetVal = tapiRequestMakeCall(PhoneNumber, "", "", "")

        If RetVal < 0 Then
           Msg = "Unable to dial number " & PhoneNumber
           GoTo Err_DialNumber
        End If

        Exit Function

Err_DialNumber:            'This is not an On Error routine.
        Msg = Msg & vbCr & vbCr & _
           "Make sure no other devices are using the Com port"
        MsgBoxType = MB_ICONSTOP
        MsgBoxTitle = "Dial Number Error"
        MsgBox Msg, MsgBoxType, MsgBoxTitle

     End Function

Private Sub Command1_Click()
Call DialNumber("0755")
End Sub

关于我们 | 联系我们 | 广告服务 | 本站动态 | 友情链接 | 法律声明 | 非法和不良信息举报

工控网客服热线:0755-86369299
版权所有 工控网 Copyright©2024 Gkong.com, All Rights Reserved

31.2002