2004-02-14 09:34出處:CSDN作者:rainstormmaster責任編輯:linjixiong
今天夜裡兩點,還沒有入睡,就把取得序列號的代碼簡單寫了一下,沒有分別在不同的系統上調試,只在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
鍵盤也能翻頁,試試「← →」鍵
The requested resource resides temporarily under a different URI.
Powered by Tengine