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

📄 电话拨号.frm

📁 个人VB学习源码精选,自己学习时的一些编程小程序,希望对大家有帮助
💻 FRM
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   1335
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4125
   LinkTopic       =   "Form1"
   ScaleHeight     =   1335
   ScaleWidth      =   4125
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "断开"
      Height          =   315
      Left            =   2940
      TabIndex        =   3
      Top             =   900
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "拨号"
      Height          =   315
      Left            =   1740
      TabIndex        =   2
      Top             =   900
      Width           =   975
   End
   Begin VB.TextBox Text1 
      Height          =   270
      Left            =   1680
      TabIndex        =   1
      Top             =   120
      Width           =   1695
   End
   Begin MSCommLib.MSComm MSComm1 
      Left            =   0
      Top             =   660
      _ExtentX        =   1005
      _ExtentY        =   1005
      _Version        =   393216
      CommPort        =   3
      DTREnable       =   -1  'True
   End
   Begin VB.Label Label1 
      Caption         =   "拨叫的电话号码:"
      Height          =   255
      Left            =   180
      TabIndex        =   0
      Top             =   180
      Width           =   1455
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Torikesi As Boolean

Private Sub Command1_Click()
    If Text1.Text = "" Then Exit Sub
    Torikesi = False
    Command1.Enabled = False
    do_Dial
    Command1.Enabled = True
End Sub

Private Sub Command2_Click()
    Torikesi = True
End Sub
Private Sub do_Dial()
    Dim DialStr As String
    Dim RecStr As String
    Dim dmy As Integer
    DialStr = "atdt" + Text1.Text + ";" + Chr(13)
    On Error Resume Next
    MSComm1.PortOpen = True
    If Err.Number <> 0 Then
        MsgBox "COM3端口不能使用"
        Exit Sub
    End If
    MSComm1.InBufferCount = 0
    MSComm1.Output = DialStr
    RecStr = ""
    Do
        dmy = DoEvents()
        If MSComm1.InBufferCount Then
            RecStr = RecStr + MSComm1.Input
            If InStr(RecStr, "OK") Then
                MsgBox "电话正在接通,请你提机准备通话"
                Exit Do
            End If
        End If
        If Torikesi Then Exit Do
    Loop
    MSComm1.Output = "ATH" + Chr(13)
    MSComm1.PortOpen = False
End Sub

Private Sub Form_Unload(Cancel As Integer)
    End
End Sub

⌨️ 快捷键说明

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