Private Declare Function GetVolumeInformation Lib "kernel32.dll" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Integer, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long
代码:
Function GetSerialNumber(sRoot As String) As Long
Dim lSerialNum As Long
Dim R As Long
Dim sTemp1 As String, sTemp2 As String
strLabel = String$(255, Chr$(0))
注释: 磁盘卷标
strType = String$(255, Chr$(0))
注释: 文件系统类型 一般为 FAT
R = GetVolumeInformation(sRoot, strLabel, Len(strLabel), lSerialNum, 0, 0, strType, Len(strType))
GetSerialNumber = lSerialNum
注释:在 strLabel 中为 磁盘卷标
注释:在 strType 中为 文件系统类型
End Function
用法:
当驱动器不存在时,函数返回 0。如果是个非根目录,也将返回 0:
lSerial = GetSerialNumber("c:\")
【VB取磁盘序列号卷标和文件系统类型】相关文章:
Vb中控件的自动排列05-07
写未来的作文300字05-07
小学父爱的作文600字05-07
2018国家电网新大纲财会类市场模拟卷多选题(二)05-07
荷花作文600字05-07
2016年职称英语综合类阅读判断练习八05-07
07年4月北师大“中国古代文学史(一)”串讲(5)05-07
寓言作文300字05-07
关于清明节的英语作文:清明节05-07
儿童舞蹈教程:国标新手上路05-07
嘿我成功了作文05-07
生态护坡技术创新措施论文05-07
