永发信息网

vb 获取u盘名称

答案:1  悬赏:30  手机版
解决时间 2021-03-17 17:55
  • 提问者网友:你挡着我发光了
  • 2021-03-17 14:13
如题~~..
顺便可以的话.说一下怎么弹出u盘..直接弹出..不要再叫我百度了..资源我都翻到最后一页都没有一个好方法..
最佳答案
  • 五星知识达人网友:神鬼未生
  • 2021-03-17 15:11
Private Declare Function GetVolumeInformation Lib "kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long
Private Sub Command1_Click()
Dim lpRootPathName As String
Dim strLabel As String * 255 '磁盘卷标
Dim strType As String * 255 '文件系统类型

lpRootPathName = "h:\"
Call GetVolumeInformation(lpRootPathName, strLabel, _
Len(strLabel), lSerialNum, 0, 0, strType, Len(strType))
i = InStr(strLabel, Chr(0))
strLabel = Left(strLabel, i - 1)
i = InStr(strType, Chr(0))
MsgBox "磁盘卷标为:" & Trim(strLabel)
End Sub
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯