ダイヤラを呼び出す          <TOP>


Windows附属のダイヤラを利用します。

tapiRequestMakeCall TAPI32(ダイヤラ)を呼び出す

 

電話番号を入力し「ダイヤラ」をクリックします。

WindowsXPでのダイヤラ接続画面

Windows2000でのダイヤラ接続画面

通話・回線切断

 

'================================================================
'= テレホンダイヤラー
'=    (TelDialer.bas)
'================================================================
#include "Windows.bi"

' TAPI32(ダイヤラー)を呼び出す
Declare Function Api_tapiRequestMakeCall& Lib "TAPI32" Alias "tapiRequestMakeCall" (ByVal DestAddress$, ByVal AppName$, ByVal CalledParty$, ByVal Comment$)
        
#define TAPIERR_NOREQUESTRECIPIENT -2
#define TAPIERR_REQUESTQUEUEFULL -3
#define TAPIERR_INVALDESTADDRESS -4

Var Shared Edit1 As Object
Var Shared Button1 As Object

Edit1.Attach GetDlgItem("Edit1") : Edit1.SetFontSize 14
button1.Attach GetDlgItem("Button1") : Button1.SetFontSize 14

'================================================================
'=
'================================================================
Declare Sub DialNumber(Number As String, sName As String)
Sub DialNumber(Number As String, sName As String)
    Var Buff As String
    Var Ret As Long

    sName = "TOKO"
    Ret = Api_tapiRequestMakeCall(Trim$(Number), Chr$(0), Trim$(sName), "")

    If Ret <> 0 Then
        Buff = "ダイヤルエラー : "
        
        select case Ret
            case TAPIERR_NOREQUESTRECIPIENT
                Buff = Buff & "Windowsのダイヤラーが起動できません!"
                    
            case TAPIERR_REQUESTQUEUEFULL
                Buff = Buff & "ダイヤル要求が満杯です!"
                                    
            case TAPIERR_INVALDESTADDRESS
                Buff = Buff & "指定の電話番号はありません!"
                
            case Else
                 Buff = Buff & "未知のエラーです!"
                
        End select
        
        A% = MessageBox("", Buff, 0, 2)
    End If
End Sub

'================================================================
'=
'================================================================
Declare Sub Button1_on edecl ()
Sub Button1_on()
    Var Number As String

    Number = Edit1.GetWindowText()

    DialNumber Number, "Test"
End Sub

'================================================================
'=
'================================================================
Declare Sub MainForm_QueryClose edecl ()
Sub MainForm_QueryClose()
    End
End Sub

'================================================================
'=
'================================================================
While 1
    WaitEvent
Wend
Stop
End