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