获取序列号是要读取软硬光盘的信息,可通过以下函数获得:
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。
(本文来源于图老师网站,更多请访问http://m.tulaoshi.com/bianchengyuyan/)现在说明一下这个函数:
它用于获取序列号,卷标,盘信息(如:是否压缩等)以下一个例子:
先定以一个调用它的自定义函数:
Function GetItNum(strDrv As String) As LongDim GetNum As LongDim Rs As LongDim Temp1 As StringDim Temp2 As StringTemp1 = String$(255, Chr$(0))Temp2 = String$(255, Chr$(0))Rs = GetVolumeInformation(strDrv, Temp1, Len(Temp1), GetNum, 0, 0, Temp2, Len(Temp2))MsgBox "卷标为:"+Temp1MsgBox "序列号为:"+Hex(SerialNum)End Function
以后使用时就调用GetItNum("盘符")就可以了!
这样就可以十分顺利的来控制鼠标了!
(本文来源于图老师网站,更多请访问http://m.tulaoshi.com/bianchengyuyan/)