用diskid.dll和disk32.dll获得硬盘序列号

2008-02-23 07:04:28来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折

1 2 下一页

今天夜里两点,还没有入睡,就把取得序列号的代码简单写了一下,没有分别在不同的系统上调试,只在win2000下调试通过,如果有问题的话,请告诉我,我再修改

1.调用diskid.dll实现:

Option Explicit
Private Declare Function IsWinNT Lib "DiskID.DLL" () As Long
Private Declare Function ReadPhysicalDrive9X Lib "DiskID.DLL" (driveID As Long, buffer As Long, bufLen As Long) As Long
Private Declare Function ReadPhysicalDriveInNT Lib "DiskID.DLL" (driveID As Long, buffer As Long, bufLen As Long) As Long

Private Type DRIVER_INFO_OK
ModalNumber(39) As Byte
SerialNumber(19) As Byte
ControlNum(7) As Byte
DriveType As Long
Cylinders As Long
Heads As Long
Sectors As Long
End Type

Private Sub Command1_Click()
Dim x As DRIVER_INFO_OK
Dim i As Long
If IsWinNT = 1 Then
i = ReadPhysicalDriveInNT(ByVal 0, ByVal VarPtr(x), ByVal 256)
Else
i = ReadPhysicalDrive9X(ByVal 0, ByVal VarPtr(x), ByVal 256)
End If

上一篇: WINDOWS 2000 ADVANCED SERVER群集安装

1 2 下一页

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:在VB下设计开发实时的数据采集曲线

下一篇:VB超频快餐,让我一次用个够!(六)