IsReady

"Drive "Drive "Drive

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

相關詞條

相關搜尋

熱門詞條

聯絡我們