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

📄 form1.frm

📁 this software design with visualbasic
💻 FRM
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form form1 
   Caption         =   "获取计算机上串口的数量"
   ClientHeight    =   2715
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   2715
   ScaleWidth      =   4680
   StartUpPosition =   1  '所有者中心
   Begin VB.CommandButton Command2 
      Caption         =   "退出"
      Height          =   555
      Left            =   2340
      TabIndex        =   2
      Top             =   1590
      Width           =   1275
   End
   Begin VB.CommandButton Command1 
      Caption         =   "获取"
      Height          =   555
      Left            =   1050
      TabIndex        =   0
      Top             =   1590
      Width           =   1275
   End
   Begin MSCommLib.MSComm MSComm1 
      Left            =   105
      Top             =   930
      _ExtentX        =   1005
      _ExtentY        =   1005
      _Version        =   393216
      DTREnable       =   -1  'True
   End
   Begin VB.Label Label1 
      Height          =   675
      Left            =   960
      TabIndex        =   1
      Top             =   660
      Width           =   2925
   End
End
Attribute VB_Name = "form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i, j As Integer
Private Sub Command1_Click()
  j = 0
  For i = 1 To 16
      MSComm1.CommPort = i
      On Error Resume Next
      MSComm1.PortOpen = True
      If Err.Number = 0 Then
         j = j + 1
       Else
         MSComm1.PortOpen = False
      End If
  Next i
  Label1.Caption = "您计算机上的串口数: " & j & "个"
End Sub

Private Sub Command2_Click()
  End
End Sub

⌨️ 快捷键说明

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