IsReady,函式名,返回指定的驅動器。
基本介紹
- 中文名:IsReady
- 返回值: True、False
- 類型:指令
- 對象:指定的驅動器
IsReady 屬性 描述如果指定的驅動器已準備好,返回 True;否則返回 False。語法object.IsReadyobject 總是一個 Drive 對象。說明對於可刪除媒體驅動器和 CD-ROM 驅動器來說,僅當插入了適當的媒體,並已準備好供訪問時,IsReady 才返回 True。下面的代碼舉例說明了 IsReady 屬性的用法:Sub ShowDriveInfo(drvpath)
Dim fs, d, s, t
Set fs = CreateObject("Scripting.FileSystemObject")
Set d = fs.GetDrive(drvpath)
Select Case d.DriveType
Case 0: t = "Unknown"
Case 1: t = "Removable"
Case 2: t = "Fixed"
Case 3: t = "Network"
Case 4: t = "CD-ROM"
Case 5: t = "RAM Disk"
End Select
s = "Drive " & d.DriveLetter & ": - " & t
If d.IsReady Then
s = s & vbCrLf & "Drive is Ready."
Else
s = s & vbCrLf & "Drive is not Ready."
End If
MsgBox s
End Sub