如何在VB中拨打电话

ebcow 2000-08-13 10:43:00
Windows9x/2000中带有电话拨号程序,能够拨打电话,不知在VB中如何调用,使其自动拨打一个给定的电话?
...全文
143 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
Joey 2000-08-13
  • 打赏
  • 举报
回复
Try This Example:


Option Explicit

Private Declare Function tapiRequestMakeCall& Lib "TAPI32.DLL" (ByVal DestAddress$, ByVal AppName$, ByVal CalledParty$, ByVal Comment$)
Private Const TAPIERR_NOREQUESTRECIPIENT = -2&
Private Const TAPIERR_REQUESTQUEUEFULL = -3&
Private Const TAPIERR_INVALDESTADDRESS = -4&


Private Sub cmdDial_Click()
Dim buff As String
Dim nResult As Long

nResult = tapiRequestMakeCall&(Trim$(txtNumber), CStr(Caption), "Test Dial", "")
If nResult <> 0 Then
buff = "Error dialing number : "
Select Case nResult
Case TAPIERR_NOREQUESTRECIPIENT
buff = buff & "No Windows Telephony dialing application is running and none could be started."
Case TAPIERR_REQUESTQUEUEFULL
buff = buff & "The queue of pending Windows Telephony dialing requests is full."
Case TAPIERR_INVALDESTADDRESS
buff = buff & "The phone number is not valid."
Case Else
buff = buff & "Unknown error."
End Select
MsgBox buff
End If
End Sub

Private Sub cmdExit_Click()
Unload Me
End Sub

Private Sub Form_Load()
Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2
EnableDial
End Sub

Private Sub txtNumber_Change()
EnableDial
End Sub

Private Sub EnableDial()
cmdDial.Enabled = Len(Trim$(txtNumber)) > 0
End Sub

7,759

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧