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

📄 form1.frm

📁 (实例168)利用MSComm控件拨电话,只是演示的版本
💻 FRM
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form Form1 
   Caption         =   "利用MSComm控件拨电话"
   ClientHeight    =   1275
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5100
   Icon            =   "Form1.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   1275
   ScaleWidth      =   5100
   StartUpPosition =   1  '所有者中心
   Begin VB.CommandButton Command2 
      Caption         =   "退出"
      Height          =   390
      Left            =   3360
      TabIndex        =   3
      Top             =   720
      Width           =   1290
   End
   Begin VB.CommandButton Command1 
      Caption         =   "拨号"
      Height          =   390
      Left            =   1695
      TabIndex        =   2
      Top             =   720
      Width           =   1290
   End
   Begin VB.TextBox Text1 
      Height          =   390
      Left            =   1680
      TabIndex        =   1
      Top             =   150
      Width           =   3000
   End
   Begin MSCommLib.MSComm MSComm1 
      Left            =   135
      Top             =   630
      _ExtentX        =   1005
      _ExtentY        =   1005
      _Version        =   393216
      DTREnable       =   -1  'True
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "请输入电话号码"
      Height          =   255
      Left            =   315
      TabIndex        =   0
      Top             =   270
      Width           =   1335
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()   '拨打电话
  If Text1.Text = "" Then
     MsgBox "请输入电话号码!", vbQuestion, "提示信息"
     Text1.SetFocus
  End If
    MSComm1.CommPort = 1   '设置通讯端口号
    MSComm1.Settings = "4800,N,8,1"   '设置波特率、奇偶校验、数据位、停止位参数
    MSComm1.PortOpen = True
    MSComm1.Output = "ATDT" & Text1.Text & vbCr
    MsgBox " 请听电话!", vbQuestion, "提示信息"
    MSComm1.PortOpen = False
End Sub
Private Sub Command2_Click()
  End
End Sub

⌨️ 快捷键说明

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