VB硬盘序列号介绍
第一个是一个函数,连在一起不要断开。第二个是一个窗体加载的事件,请写入某个窗体的代码中,
Private Declare Function 获得硬盘序列号 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
Private Sub Form_Load()
On Error GoTo Err_Form_Load
Dim aa As Long
Dim VolName As String
Dim 硬盘序列号 As Long
Dim Maxlen As Long
Dim Sysflag As Long
Dim fsysName As String
aa = 获得硬盘序列号("c:/", VolName, 256, 硬盘序列号, Maxlen, Sysflag, fsysName, 256)
msgbox "c 硬盘序列号(16制): " & hex(硬盘序列号)
Exit Sub
Err_Form_Load:
End Sub
本文地址:http://www.45fan.com/a/question/72550.html