读取软硬光盘序列号

来源:互联网 发布:广播电视网络 编辑:程序博客网 时间:2024/04/29 21:48
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

 

读取软硬光盘序列号

获取序列号是要读取软硬光盘的信息,可通过以下函数获得:
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("盘符")就可以了!
这样就可以十分顺利的来控制鼠标了!

<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>