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

📄 autodial.frm

📁 vb 程序基础设计与编程对初学者会有很大帮助
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Auto-Dial"
   ClientHeight    =   1830
   ClientLeft      =   3765
   ClientTop       =   3720
   ClientWidth     =   3510
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   1830
   ScaleWidth      =   3510
   ShowInTaskbar   =   0   'False
   Begin VB.CommandButton Command2 
      Caption         =   "退出"
      Height          =   375
      Left            =   1920
      TabIndex        =   3
      Top             =   1200
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "拨号"
      Height          =   375
      Left            =   360
      TabIndex        =   2
      Top             =   1200
      Width           =   1215
   End
   Begin VB.TextBox Text1 
      Height          =   285
      Left            =   120
      TabIndex        =   0
      Top             =   600
      Width           =   3255
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "请输入要拨打的电话号码:"
      Height          =   180
      Left            =   120
      TabIndex        =   1
      Top             =   360
      Width           =   2160
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Declare Function tapiRequestMakeCall& Lib "TAPI32.DLL" (ByVal DestAddress$, ByVal AppName$, ByVal CalledParty$, ByVal Comment$)
Private Const TAPIERR_NOREQUESTRECIPIENT = -2&
Private Const TAPIERR_REQUESTQUEUEFULL = -3&
Private Const TAPIERR_INVALDESTADDRESS = -4&


Private Sub Command1_Click()
    Dim buff As String
    Dim nResult As Long

    '打开调制解调器拨号
    nResult = tapiRequestMakeCall&(Trim$(txtNumber), CStr(Caption), "Test Dial", "")
    '显示出错信息
    If nResult <> 0 Then
        buff = "非法操作 : "
        Select Case nResult
            Case TAPIERR_NOREQUESTRECIPIENT
                buff = buff & "未找到Windows拨号程序接口"
            Case TAPIERR_REQUESTQUEUEFULL
                buff = buff & "拨号已连接."
            Case TAPIERR_INVALDESTADDRESS
                buff = buff & "不正确的号码"
            Case Else
                buff = buff & "未知错误."
        End Select
        MsgBox buff
    End If
End Sub

Private Sub Command2_Click()
    Unload Me
End Sub

Private Sub Form_Load()
    Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2
    EnableDial
End Sub

Private Sub Text1_Change()
    EnableDial
End Sub

Private Sub EnableDial()
    Command1.Enabled = Len(Trim$(Text1.Text)) > 0
End Sub

⌨️ 快捷键说明

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