45.txt

来自「VB实用技巧124则之1-62则 为了使每包文件个数少于65(获得更快的解压速」· 文本 代码 · 共 49 行

TXT
49
字号
利用TAPI进行电话拨号   
       
'Phone Dialer in VB

'make a new project; 2 textboxen (index 0 & 1); 2 labels (index 0 & 1)
'1 command button
'Insert the next code in the right place (use Insert/File)
'Press F5

------------- code -------------------
Option Explicit

Private Declare Function tapiRequestMakeCall& Lib "TAPI32.DLL" (ByVal DestAdress$, ByVal AppName$, ByVal CalledParty$, ByVal Comment$)

Private Sub ChooseNumber(strNumber As String, strAppName As String, strName As String)
Dim lngResult As Long
Dim strBuffer As String

lngResult = tapiRequestMakeCall&(strNumber, strAppName, strName, "")
If lngResult <> 0 Then 'error
strBuffer = "Error connecting to number: "
Select Case lngResult
Case -2&
strBuffer = strBuffer & " 'PhoneDailer not installed?"
Case -3&
strBuffer = strBuffer & "Error : " & CStr(lngResult) & "."
End Select

MsgBox strBuffer
End If

End Sub

Private Sub Command1_Click()
Call ChooseNumber(Text1(0).Text, "PhoneDialer", Text1(1).Text)

End Sub


Private Sub Form_Load()
Text1(0).Text = ""
Text1(1).Text = ""

End Sub

Private Sub Form_Unload(Cancel As Integer)
End

End Sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?