Full width home advertisement

Post Page Advertisement [Top]

Here is an idea to detect Drive Type in VB6....

Goto Project Menu -> References
Tick on Windows Script Host Modal Object (scroll at last to get)
Click Ok
Now, Copy this function and paste in your form:

private function mDriveType(DriveLetter as string)



dim dType as DriveTypeConst
dim a As New IWshRuntimeLibrary.FileSystemObject
dtype = a.drives(DriveLetter).DriveType
Select Case dType
Case Removable:
mDriveType = "Removable Disk"
Exit Function
Case Fixed:
mDriveType = "Hard Disk"
Exit Function
Case RamDisk:
mDriveType = "RAM"
Case CDRom:
mDriveType = "CD ROM"
Case Remote:
mDriveType = "Network Drive"
Case UnknownType:
mDriveType = "Unknown Type"

End Select
End Function

After this you can use this code like this

msgbox mDriveType("C:")

No comments:

Post a Comment

Bottom Ad [Post Page]

| Designed by Colorlib