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

📄 form1.frm

📁 本例将介绍如何判断驱动器。运行程序
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "判断驱动器"
   ClientHeight    =   2190
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   3135
   Icon            =   "Form1.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   ScaleHeight     =   2190
   ScaleWidth      =   3135
   StartUpPosition =   1  '所有者中心
   Begin VB.Frame Frame1 
      Height          =   1545
      Left            =   120
      TabIndex        =   2
      Top             =   105
      Width           =   2850
      Begin VB.TextBox Text1 
         Alignment       =   2  'Center
         BackColor       =   &H00FFFFFF&
         BeginProperty Font 
            Name            =   "隶书"
            Size            =   15.75
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   390
         Left            =   300
         TabIndex        =   3
         Text            =   "c"
         Top             =   945
         Width           =   2265
      End
      Begin VB.Label Label1 
         Alignment       =   2  'Center
         BackColor       =   &H00FFFFFF&
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C000C0&
         Height          =   375
         Left            =   300
         TabIndex        =   4
         Top             =   390
         Width           =   2250
      End
   End
   Begin VB.CommandButton Command1 
      Caption         =   "判断驱动器"
      Height          =   345
      Left            =   780
      TabIndex        =   1
      Top             =   1725
      Width           =   1080
   End
   Begin VB.CommandButton Command2 
      Caption         =   "退出"
      Height          =   345
      Left            =   1890
      TabIndex        =   0
      Top             =   1725
      Width           =   1080
   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 GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long

Private Sub Command1_Click()
  Dim k
  Dim i
  Dim r
  k = Text1.Text + ":\"
  r = GetDriveType(k)
  Select Case r
         Case 2
         Label1.Caption = "该盘是软盘"
         Case 3
         Label1.Caption = "该盘是硬盘"
         Case 4
         Label1.Caption = "该盘是网络映射盘"
         Case 5
         Label1.Caption = "该盘是光驱"
         Case 6
         Label1.Caption = "该盘是RAM DISK"
         Case Else
         Label1.Caption = "不知道的设备"
  End Select
End Sub

Private Sub Command2_Click()
  End
End Sub

⌨️ 快捷键说明

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