TAPI, Dial a phone number : TAPI « Windows « VB.Net Tutorial

VB.Net Tutorial
1. Language Basics
2. Data Type
3. Operator
4. Statements
5. Date Time
6. Class Module
7. Development
8. Collections
9. Generics
10. Attributes
11. Event
12. Stream File
13. GUI
14. GUI Applications
15. 2D Graphics
16. I18N Internationlization
17. Reflection
18. Regular Expressions
19. Security
20. Socket Network
21. Thread
22. Windows
23. XML
24. Database ADO.net
25. Design Patterns
Microsoft Office Word 2007 Tutorial
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial » Windows » TAPI 
22. 10. 1. TAPI, Dial a phone number
TAPI, Dial a phone number
 

Imports System.Windows.Forms

public class PhoneTAPI
   public Shared Sub Main
        Application.Run(New Form1)
   End Sub
End class

Public Class Form1
    Inherits System.Windows.Forms.Form
    Public Sub New()
        MyBase.New()

        InitializeComponent()

    End Sub

    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is NothingThen
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    Private components As System.ComponentModel.IContainer

    Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Button2 As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()Private Sub InitializeComponent()
        Me.TextBox1 = New System.Windows.Forms.TextBox
        Me.Label1 = New System.Windows.Forms.Label
        Me.Button1 = New System.Windows.Forms.Button
        Me.Label2 = New System.Windows.Forms.Label
        Me.Button2 = New System.Windows.Forms.Button
        Me.SuspendLayout()
        '
        'TextBox1
        '
        Me.TextBox1.Location = New System.Drawing.Point(12032)
        Me.TextBox1.Name = "TextBox1"
        Me.TextBox1.Size = New System.Drawing.Size(15220)
        Me.TextBox1.TabIndex = 0
        Me.TextBox1.Text = ""
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(1632)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(10432)
        Me.Label1.TabIndex = 1
        Me.Label1.Text = "Phone #"
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(6472)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(6424)
        Me.Button1.TabIndex = 2
        Me.Button1.Text = "Dial"
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(32120)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(240104)
        Me.Label2.TabIndex = 3
        Me.Label2.Text = "Message"
        '
        'Button2
        '
        Me.Button2.Location = New System.Drawing.Point(16072)
        Me.Button2.Name = "Button2"
        Me.Button2.Size = New System.Drawing.Size(6424)
        Me.Button2.TabIndex = 4
        Me.Button2.Text = "Exit"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(513)
        Me.ClientSize = New System.Drawing.Size(292246)
        Me.Controls.Add(Me.Button2)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.TextBox1)
        Me.ResumeLayout(False)

    End Sub

    Declare Auto Function tapiRequestMakeCall Lib "TAPI32.dll" (ByVal DestAddress As String, ByVal AppName As String, ByVal CalledParty As String, ByVal Comment As StringAs Integer
    Const TAPIERR_CONNECTED As Short = 0
    Const TAPIERR_NOREQUESTRECIPIENT As Short = -2
    Const TAPIERR_REQUESTQUEUEFULL As Short = -3
    Const TAPIERR_INVALDESTADDRESS As Short = -4
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgsHandles Button1.Click
        Dim Str As String
        Dim As Short
        Dim buff As String
        Str = Trim(TextBox1.Text)
        Try
            t = tapiRequestMakeCall(Str, "Dial", Str, "")
        Catch ex As Exception
            Label2.Text = "Error"
        End Try
        If t <> Then
            buff = "Error"
            Select Case t
                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 & "Unkown error."
            End Select
        Else
            buff = "Dialing"
        End If
        Label2.Text = buff
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgsHandles Button2.Click
        End
    End Sub
End Class

        
22. 10. TAPI
22. 10. 1. TAPI, Dial a phone numberTAPI, Dial a phone number
w_w__w__.___j__a_va__2__s_.c_o_m | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.