CSDN博客

img shawls

读取软硬光盘序列号

发表于2001/6/3 10:33:00  1171人阅读

 

读取软硬光盘序列号

获取序列号是要读取软硬光盘的信息,可通过以下函数获得:
Public 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 GetItNum(strDrv As String) As Long
Dim GetNum As Long
Dim Rs As Long
Dim Temp1 As String
Dim Temp2 As String
Temp1 = String$(255, Chr$(0))
Temp2 = String$(255, Chr$(0))
Rs = GetVolumeInformation(strDrv, Temp1, Len(Temp1), GetNum, 0, 0, Temp2, Len(Temp2))
MsgBox "卷标为:"+Temp1
MsgBox "序列号为:"+Hex(SerialNum)
End Function

以后使用时就调用GetItNum("盘符")就可以了!
这样就可以十分顺利的来控制鼠标了!

0 0

相关博文

我的热门文章

img
取 消
img