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

📄 custodial.frm

📁 使用环境VC++ 6.0
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmCustoDial 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "CustoDial"
   ClientHeight    =   2076
   ClientLeft      =   996
   ClientTop       =   1740
   ClientWidth     =   4464
   Icon            =   "CustoDial.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   2076
   ScaleWidth      =   4464
   ShowInTaskbar   =   0   'False
   Begin VB.TextBox txtComment 
      Height          =   288
      Left            =   1200
      TabIndex        =   9
      Top             =   1560
      Width           =   1692
   End
   Begin VB.TextBox txtAreaCode 
      Height          =   288
      Left            =   1200
      TabIndex        =   5
      Top             =   840
      Width           =   1692
   End
   Begin VB.CommandButton cmdAbout 
      Caption         =   "&About..."
      Height          =   372
      Left            =   3120
      TabIndex        =   12
      Top             =   1080
      Width           =   1212
   End
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "Cancel"
      Height          =   372
      Left            =   3120
      TabIndex        =   11
      Top             =   600
      Width           =   1212
   End
   Begin VB.CommandButton cmdDial 
      Caption         =   "Dial"
      Default         =   -1  'True
      Height          =   372
      Left            =   3120
      TabIndex        =   10
      Top             =   120
      Width           =   1212
   End
   Begin VB.TextBox txtPhoneNo 
      Height          =   288
      Left            =   1200
      TabIndex        =   7
      Top             =   1200
      Width           =   1692
   End
   Begin VB.TextBox txtCountryCode 
      Height          =   288
      Left            =   1200
      TabIndex        =   3
      Top             =   480
      Width           =   1692
   End
   Begin VB.TextBox txtName 
      Height          =   288
      Left            =   1200
      TabIndex        =   1
      Top             =   120
      Width           =   1692
   End
   Begin VB.Label Label5 
      Caption         =   "C&omment"
      Height          =   252
      Left            =   120
      TabIndex        =   8
      Top             =   1560
      Width           =   972
   End
   Begin VB.Label Label4 
      Caption         =   "&Phone No."
      Height          =   252
      Left            =   120
      TabIndex        =   6
      Top             =   1200
      Width           =   972
   End
   Begin VB.Label Label3 
      Caption         =   "&Area Code"
      Height          =   252
      Left            =   120
      TabIndex        =   4
      Top             =   840
      Width           =   972
   End
   Begin VB.Label Label2 
      Caption         =   "&Name"
      Height          =   252
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   972
   End
   Begin VB.Label Label1 
      Caption         =   "&Country Code"
      Height          =   252
      Left            =   120
      TabIndex        =   2
      Top             =   480
      Width           =   972
   End
End
Attribute VB_Name = "frmCustoDial"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

' Assisted Telephony prototypes
Private Const TAPIERR_REQUESTFAILED = -16&
Private Const TAPIERR_NOREQUESTRECIPIENT = -2&
Private Const TAPIERR_REQUESTQUEUEFULL = -3&
Private Const TAPIERR_INVALDESTADDRESS = -4&
Private Const TAPIERR_INVALPOINTER = -18&

Private Declare Function tapiGetLocationInfo Lib "TAPI32.DLL" (ByVal lpszCountryCode As String, ByVal lpszCityCode As String) As Long
Private Declare Function tapiRequestMakeCall Lib "TAPI32.DLL" (ByVal lpszDestAddress As String, ByVal lpszAppName As String, ByVal lpszCalledParty As String, ByVal lpszComment As String) As Long

Private Sub cmdAbout_Click()
    frmAbout.Show 1
End Sub

Private Sub cmdCancel_Click()
    End
End Sub

Private Sub Form_Load()
    ' Center the form
    Left = (Screen.Width - Width) / 2
    Top = (Screen.Height - Height) / 2
    
    ' Initialize the form
    txtName = "A. Nonymous"
    Dim sCountryCode As String * 8
    Dim sAreaCode As String * 8

    ' Get default location info
    Dim r As Long
    r = tapiGetLocationInfo(sCountryCode, sAreaCode)
    If r = TAPIERR_REQUESTFAILED Then
        MsgBox "There is no location information available."
    Else
        txtCountryCode = sCountryCode
        txtAreaCode = sAreaCode
    End If
End Sub

Private Sub cmdDial_Click()
    ' Init arguments to tapiRequestMakeCall()
    Dim sAppName As String
    Dim sComment As String
    
    sAppName = "CustoDial, VB"
    sComment = txtComment
    
    Dim sDestAddress As String
    ' Try to make canonical phone number
    If txtCountryCode <> "" And txtPhoneNo <> "" Then
        If txtAreaCode <> "" Then
            sDestAddress = "+" & txtCountryCode & " (" & txtAreaCode & ") " & txtPhoneNo
        Else
            sDestAddress = "+" & txtCountryCode & " " & txtPhoneNo
        End If
    ' Can't make it canonical easily, so let the request recipient deal w/ it.
    Else
        sDestAddress = txtCountryCode & " " & txtAreaCode & " " & txtPhoneNo
    End If
    
    ' Dial the number
    Dim sName As String
    sName = txtName
    
    Dim r As Long
    r = tapiRequestMakeCall(sDestAddress, sAppName, sName, sComment)
    
    Select Case r
    Case TAPIERR_NOREQUESTRECIPIENT
        MsgBox "There is no registered Telephony request recipient."
    Case TAPIERR_REQUESTQUEUEFULL
        MsgBox "The Telephony request recipient has refused your request."
    Case TAPIERR_INVALDESTADDRESS
        MsgBox "The Telephony request recipient is unable to dial the phone number you entered."
    Case TAPIERR_INVALPOINTER
        MsgBox "VB screwed up."
    End Select
    
    ' Exit the application
    End
End Sub

Private Sub txtAreaCode_GotFocus()
    txtAreaCode.SelStart = 0
    txtAreaCode.SelLength = Len(txtAreaCode.Text)
End Sub

Private Sub txtCountryCode_GotFocus()
    txtCountryCode.SelStart = 0
    txtCountryCode.SelLength = Len(txtCountryCode.Text)
End Sub

Private Sub txtName_GotFocus()
    txtName.SelStart = 0
    txtName.SelLength = Len(txtName.Text)
End Sub

Private Sub txtPhoneNo_GotFocus()
    txtPhoneNo.SelStart = 0
    txtPhoneNo.SelLength = Len(txtPhoneNo.Text)
End Sub

Private Sub txtComment_GotFocus()
    txtComment.SelStart = 0
    txtComment.SelLength = Len(txtComment.Text)
End Sub

⌨️ 快捷键说明

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