清醒时做事,糊涂时读书,大怒时睡觉,无聊时关注图老师为大家准备的精彩内容。下面为大家推荐读取软硬光盘序列号,无聊中的都看过来。
【 tulaoshi.com - 编程语言 】
获取序列号是要读取软硬光盘的信息,可通过以下函数获得:
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://www.tulaoshi.com/bianchengyuyan/)它用于获取序列号,卷标,盘信息(如:是否压缩等)以下一个例子:
(本文来源于图老师网站,更多请访问http://www.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://www.tulaoshi.com/n/20160219/1608348.html