<VB数理统计实用算法>书中的算法源程序
源代码在线查看: 数据库_通用f9.frm
VERSION 5.00
Begin VB.Form frmDriveList
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "驱动器列表"
ClientHeight = 4155
ClientLeft = 60
ClientTop = 450
ClientWidth = 4725
LinkTopic = "Form1"
ScaleHeight = 4155
ScaleWidth = 4725
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton cmdExit
Caption = "退出"
Height = 375
Left = 3480
TabIndex = 4
Top = 3600
Width = 975
End
Begin VB.ListBox lstFree
Height = 2940
Left = 2400
TabIndex = 2
Top = 480
Width = 2055
End
Begin VB.ListBox lstAll
Height = 2940
Left = 240
TabIndex = 0
Top = 480
Width = 1935
End
Begin VB.Label lblFree
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "可用空间"
ForeColor = &H80000008&
Height = 255
Left = 2400
TabIndex = 3
Top = 240
Width = 2055
End
Begin VB.Label lblAll
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "总空间"
ForeColor = &H80000008&
Height = 255
Left = 240
TabIndex = 1
Top = 240
Width = 1935
End
End
Attribute VB_Name = "frmDriveList"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'frmDriveList窗体
'使用文件系统对象
'对驱动器进行扫描,显示驱动器名称和大小
Option Explicit
Private Sub Form_Load()
Dim objFSO As New FileSystemObject '根对象
Dim objDrive As Drive '驱动器对象
'对驱动器进行扫描
For Each objDrive In objFSO.Drives
If objDrive.IsReady Then '驱动器是否准备好
If objDrive.DriveType = 2 Then
lstAll.AddItem objDrive.Path & _
Int(objDrive.TotalSize / 2 ^ 20) & "兆" & "(固定盘)"
lstFree.AddItem objDrive.Path & _
Int(objDrive.FreeSpace / 2 ^ 20) & "兆" & "(固定盘)"
End If
If objDrive.DriveType = 1 Then
lstAll.AddItem objDrive.Path & _
Int(objDrive.TotalSize / 2 ^ 20) & "兆" & "(可移动盘)"
lstFree.AddItem objDrive.Path & _
Int(objDrive.FreeSpace / 2 ^ 20) & "兆" & "(可移动盘)"
End If
End If
Next
End Sub
Private Sub cmdExit_Click()
Unload Me
frmDatabase.Show
End Sub