通过硬盘的驱动用VC读取硬盘序列号

时间:2013-04-29 14:46:08
【文件属性】:

文件名称:通过硬盘的驱动用VC读取硬盘序列号

文件大小:17KB

文件格式:RAR

更新时间:2013-04-29 14:46:08

硬盘序列号,VC,硬盘的驱动

在模块中加入下列声明: Public Declare Function GetVolumeInformation Lib "kernel32" _ Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, _ ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, _ lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, _ lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, _ ByVal nFileSystemNameSize As Long) As Long '得到某一磁盘分区的信息,如C: 窗体代码如下: Option Explicit Private Regid, Localid As Long Private Sub CmdLocalID_Click() '根据C盘序列号得到原ID Dim Driver, VolName, Fsys As String Dim volNumber, MCM, FSF As Long Driver = "c:\" Dim res As Long res = GetVolumeInformation(Driver, VolName, 127, volNumber, MCM, FSF, Fsys, 127) 'volNumber是C盘序列号 Localid = volNumber / 2 + 123456789 Text1.Text = Localid End Sub Private Sub CmdRegID_Click() '根据原ID算出注册ID If IsNumeric(Text1.Text) Then


【文件预览】:
diskid32.exe

网友评论

  • 有点问题 啊,我怎么觉得。
  • 例子可以运行,不错的参考
  • 是获取硬盘分卷的随机编号(如 C 盘),而不是硬盘物理序列号,但还是谢谢提供