vb获磁盘号分区号?
1个回答
展开全部
Private Declare Function GetLogicalDriveStrings Lib "kernel32" Alias "GetLogicalDriveStringsA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
Private Sub Form_Load()
Dim strSave As String
Dim drvName As String
Me.AutoRedraw = True
strSave = String(255, Chr$(0))
ret& = GetLogicalDriveStrings(255, strSave)
For keer = 1 To 100
If Left$(strSave, InStr(1, strSave, Chr$(0))) = Chr$(0) Then Exit For
drvName = Left$(strSave, InStr(1, strSave, Chr$(0)) - 1)
Select Case GetDriveType(drvName)
Case 0
Me.Print "不明 " + "盘符为: " + drvName
Case 2
Me.Print "软驱 " + "盘符为: " + drvName
Case 3
Me.Print "硬盘 " + "盘符为: " + drvName
Case 4
Me.Print "网络盘 " + "盘符为: " + drvName
Case 5
Me.Print "光驱 " + "盘符为: " + drvName
Case 6
Me.Print "RamDisk " + "盘符为: " + drvName
End Select
strSave = Right$(strSave, Len(strSave) - InStr(1, strSave, Chr$(0)))
Next keer
End Sub
Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
Private Sub Form_Load()
Dim strSave As String
Dim drvName As String
Me.AutoRedraw = True
strSave = String(255, Chr$(0))
ret& = GetLogicalDriveStrings(255, strSave)
For keer = 1 To 100
If Left$(strSave, InStr(1, strSave, Chr$(0))) = Chr$(0) Then Exit For
drvName = Left$(strSave, InStr(1, strSave, Chr$(0)) - 1)
Select Case GetDriveType(drvName)
Case 0
Me.Print "不明 " + "盘符为: " + drvName
Case 2
Me.Print "软驱 " + "盘符为: " + drvName
Case 3
Me.Print "硬盘 " + "盘符为: " + drvName
Case 4
Me.Print "网络盘 " + "盘符为: " + drvName
Case 5
Me.Print "光驱 " + "盘符为: " + drvName
Case 6
Me.Print "RamDisk " + "盘符为: " + drvName
End Select
strSave = Right$(strSave, Len(strSave) - InStr(1, strSave, Chr$(0)))
Next keer
End Sub
Storm代理
2023-07-25 广告
2023-07-25 广告
StormProxies是一家国内优质海外HTTP代理商,拥有一个庞大的IP资源池,覆盖200多个地区,IP数量大且匿名度高。其优点还包括超高并发、稳定高效、技术服务等特点,同时提供HTTP、HTTPS以及SOCKS5协议支持。此外,Sto...
点击进入详情页
本回答由Storm代理提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询