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

📄 frmdrive.frm

📁 Visual Basic 6 大学教程的代码
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmDrive 
   Caption         =   "Fig. 14.15: Drive FSO"
   ClientHeight    =   1320
   ClientLeft      =   2865
   ClientTop       =   3045
   ClientWidth     =   4710
   LinkTopic       =   "Form1"
   ScaleHeight     =   1320
   ScaleWidth      =   4710
   Begin VB.DriveListBox drvBox 
      Height          =   315
      Left            =   735
      TabIndex        =   0
      Top             =   105
      Width           =   3150
   End
   Begin VB.Label lblStats 
      BorderStyle     =   1  'Fixed Single
      Height          =   300
      Index           =   1
      Left            =   60
      TabIndex        =   2
      Top             =   930
      Width           =   4545
   End
   Begin VB.Label lblStats 
      BorderStyle     =   1  'Fixed Single
      Height          =   300
      Index           =   0
      Left            =   60
      TabIndex        =   1
      Top             =   570
      Width           =   4545
   End
End
Attribute VB_Name = "frmDrive"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Fig. 14.15
' Demonstrating the Drive FSO
Option Explicit                   ' General declaration
Dim mFso As New FileSystemObject  ' General Declaration

Private Sub Form_Load()
   Call drvBox_Change    ' Call DriveListBox Change
End Sub

Private Sub drvBox_Change()
   Dim d As Drive
   
   ' Get the Drive and assign it to d
   Set d = mFso.GetDrive(drvBox.List(drvBox.ListIndex))
   
   ' Enable error handler
   On Error GoTo errhandler

      lblStats(0).Caption = "Letter: " & d.DriveLetter & _
                            Space$(3) & "S/N #: " _
                            & d.SerialNumber & Space$(3) & _
                            "Free space: " & d.FreeSpace / _
                            1000000 & " MB"

      lblStats(1).Caption = "Type: " & d.DriveType _
                            & Space$(3) & "File System: " _
                            & d.FileSystem & Space$(3) & _
                            "Total Size: " & d.TotalSize / _
                            1000000 & " MB"
      Exit Sub
      
errhandler:
      Call MsgBox(Err.Description, vbCritical, "ERROR")
      drvBox.Drive = drvBox.List(1)
      Exit Sub
End Sub

⌨️ 快捷键说明

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