⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fmain.frm

📁 用VB进行TAPI开发的源程.没有太详细的说明.有兴趣的同志得仔细看了.
💻 FRM
📖 第 1 页 / 共 2 页
字号:
VERSION 5.00
Begin VB.Form fMain 
   Caption         =   "Native VB TAPI Tester"
   ClientHeight    =   5205
   ClientLeft      =   3555
   ClientTop       =   3165
   ClientWidth     =   6705
   Icon            =   "fMain.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   347
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   447
   Begin VB.CommandButton cmdHangUp 
      Caption         =   "Hang Up"
      Height          =   555
      Left            =   4230
      TabIndex        =   13
      Top             =   3465
      Width           =   2355
   End
   Begin VB.ListBox lstCallProgress 
      Height          =   645
      Left            =   4230
      TabIndex        =   11
      Top             =   2565
      Width           =   2370
   End
   Begin VB.PictureBox picIcon 
      Height          =   660
      Left            =   5940
      ScaleHeight     =   40
      ScaleMode       =   3  'Pixel
      ScaleWidth      =   40
      TabIndex        =   9
      Top             =   135
      Width           =   660
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "Exit"
      Height          =   555
      Left            =   4230
      TabIndex        =   8
      Top             =   4545
      Width           =   2355
   End
   Begin VB.CommandButton cmdDialProps 
      Caption         =   "Dialing Properties..."
      Height          =   555
      Left            =   2160
      TabIndex        =   6
      Top             =   4545
      Width           =   1860
   End
   Begin VB.TextBox txtPhoneNumber 
      Height          =   330
      Left            =   4230
      TabIndex        =   5
      Text            =   "123-4567"
      Top             =   1215
      Width           =   2355
   End
   Begin VB.CommandButton cmdDial 
      Caption         =   "Dial..."
      Height          =   555
      Left            =   4230
      TabIndex        =   4
      Top             =   1620
      Width           =   2355
   End
   Begin VB.CommandButton cmdConfigDlg 
      Caption         =   "Line Config Dialog..."
      Height          =   555
      Left            =   135
      TabIndex        =   3
      Top             =   4545
      Width           =   1860
   End
   Begin VB.ListBox lstLineInfo 
      Height          =   3765
      Left            =   135
      TabIndex        =   2
      Top             =   525
      Width           =   3885
   End
   Begin VB.ComboBox cboLineSel 
      Height          =   300
      Left            =   2610
      Style           =   2  'Dropdown List
      TabIndex        =   0
      Top             =   135
      Width           =   1425
   End
   Begin VB.Label lblProgress 
      Caption         =   "Call Progress:"
      Height          =   240
      Left            =   4275
      TabIndex        =   12
      Top             =   2250
      Width           =   2370
   End
   Begin VB.Label lblIcon 
      Caption         =   "Icon from TSP:"
      Height          =   195
      Left            =   4230
      TabIndex        =   10
      Top             =   225
      Width           =   1200
   End
   Begin VB.Label lblPhoneNumber 
      Caption         =   "Enter Phone Number to dial:"
      Height          =   240
      Left            =   4230
      TabIndex        =   7
      Top             =   855
      Width           =   2370
   End
   Begin VB.Label lblLineSel 
      Caption         =   "Select TAPI Line number:"
      Height          =   240
      Left            =   135
      TabIndex        =   1
      Top             =   210
      Width           =   2370
   End
End
Attribute VB_Name = "fMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'****************************************************************
'*  VB file:   fMain.frm...
'*             VB TAPI Devcaps/Dialer app
'*
'*  created:        1999 by Ray Mercer
'*
'*  last modified:  8/25/99 by Ray Mercer (added comments)
'*
'*  Copyright (c) 1998 Ray Mercer.  All rights reserved.
'*  Latest version at http://i.am/shrinkwrapvb
'****************************************************************
Private Declare Function timeGetTime Lib "winmm.dll" () As Long 'for slowing down GUI only

'dimension a TAPI variable with events
Public WithEvents tapiline As CvbTAPILine
Attribute tapiline.VB_VarHelpID = -1

Private Sub Form_Load()
Dim success As Boolean
Dim line As Long

cmdHangUp.Enabled = False
Me.Show
Me.MousePointer = vbHourglass
Me.Refresh

'Initialize the TAPI class
Set tapiline = New CvbTAPILine
'Set the negotiate API version between 1.3 and 3.0
'This step is not necessary if default versions are OK (1.3 - 3.0)
'It's easy to visualize the high and low words in Hex
tapiline.LowAPI = &H10003 ' 1.3 = &H00010003
tapiline.HiAPI = &H30000 '  3.0 = &H00030000

'give user feedback and pause to let user read it
lstLineInfo.AddItem "Negotiating TAPI version..."
lstLineInfo.Refresh
Call Pause(1000, False)

'initialize and negotiate API versions for all lines
success = tapiline.Create

'List all available lines with these API caps in the listbox
If success Then
    For line = 0 To tapiline.numLines - 1
        tapiline.CurrentLineID = line
        If tapiline.NegotiatedAPIVersion Then
            cboLineSel.AddItem (line)
        End If
    Next
    'set the currently selected line (and trigger the click event)
    cboLineSel.ListIndex = 0
Else
    'give user feedback so they know their TAPI device doesn't support 2.1
    lstLineInfo.AddItem tapiline.ErrorString(tapiline.LastError)
    lstLineInfo.Refresh
    Call Pause(500, False)
    lstLineInfo.AddItem "Trying TAPI 1.3 - 1.4..."
    lstLineInfo.Refresh
    Call Pause(1000, False)
    
    'now re-negotiate lower version
    tapiline.LowAPI = &H10003 ' 1.3 = &H00010003
    tapiline.HiAPI = &H10004 '  1.4 = &H00010004
    success = tapiline.Create
    If success Then
        For line = 0 To tapiline.numLines - 1
            tapiline.CurrentLineID = line
            If tapiline.NegotiatedAPIVersion Then
                cboLineSel.AddItem (line)
            End If
        Next
        'set the currently selected line (and trigger the click event)
        cboLineSel.ListIndex = 0
    Else
        lstLineInfo.AddItem "Failed to negotiate TAPI version! <Critical Error!>"
    End If
End If



⌨️ 快捷键说明

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