主题:[讨论]GetDriveType()的问题,哭呀。
我在用这个api的时候,为什么总是返回目录不存在呀????我到底哪里错了呀?我用unicode会出问题,所以转成ansi。
number = 1
driver = GetLogicalDrives()
For i = 65 To 90
If number And driver Then
c = Chr(i)
c = c & ":" & "\" & Chr(0)
Print c,
c = StrConv(c, vbFromUnicode)
drivertype = GetDriveType(c)
If drivertype = DRIVE_REMOVABLE Then
Print "已经移除的磁盘"
ElseIf drivertype = DRIVe_FIXED Then
Print "出现故障的磁盘”"
ElseIf drivertype = DRIVE_CDROM Then
Print "是CDROM"
ElseIf drivertype = DRIVE_RAMDISK Then
Print "是可读写磁盘"
ElseIf drivertype = 0 Then
Print "不可以识别的驱动器"
ElseIf drivertype = 1 Then
Print "目录不存在"
Else
Print "发生以外错误"
End If
End If
number = number * 2
Next i
number = 1
driver = GetLogicalDrives()
For i = 65 To 90
If number And driver Then
c = Chr(i)
c = c & ":" & "\" & Chr(0)
Print c,
c = StrConv(c, vbFromUnicode)
drivertype = GetDriveType(c)
If drivertype = DRIVE_REMOVABLE Then
Print "已经移除的磁盘"
ElseIf drivertype = DRIVe_FIXED Then
Print "出现故障的磁盘”"
ElseIf drivertype = DRIVE_CDROM Then
Print "是CDROM"
ElseIf drivertype = DRIVE_RAMDISK Then
Print "是可读写磁盘"
ElseIf drivertype = 0 Then
Print "不可以识别的驱动器"
ElseIf drivertype = 1 Then
Print "目录不存在"
Else
Print "发生以外错误"
End If
End If
number = number * 2
Next i