VB获取硬盘物理序列号 源码

硬盘物理序列号,不是分区逻辑号,给源码加分,QQ:420079219
如果获取到硬盘物理序列号后,怎样加密和解密?有源码加分

Private Declare Function GetVolumeInformation _
Lib "kernel32" Alias "GetVolumeInformationA" _
(ByVal lpRootPathName As String, _
ByVal lpszVolumeNameBuffer As String, _
ByVal lVolumeNameSize As Long, _
lpVolumeSerialNumber As Long, _
lpMaximumComponentLength As Long, _
lpFileSystemFlags As Long, _
ByVal lpszFileSystemNameBuffer As String, _
ByVal nFileSystemNameSize As Long) As Long

Public Function GetVolumeSerialNumber(ByVal RootPath As String) As String

Dim lpszVolumeNameBuffer As String

Dim lpszFileSystemNameBuffer As String

Dim lVolumeNameSize As Long

Dim lpVolumeSerialNumber As Long

Dim lpMaximumComponentLength As Long

Dim lpFileSystemFlags As Long

Dim nFileSystemNameSize As Long

Dim lRetVal As Long

lpVolumeSerialNumber = 0

lpMaximumComponentLength = 0

lpFileSystemFlags = 0

lpszVolumeNameBuffer = Space$(255)

lpszFileSystemNameBuffer = Space(255)

lVolumeNameSize = Len(lpszVolumeNameBuffer)

nFileSystemNameSize = Len(lpszFileSystemNameBuffer)

lRetVal = GetVolumeInformation(RootPath, _
lpszVolumeNameBuffer, _
lVolumeNameSize, _
lpVolumeSerialNumber, _
lpMaximumComponentLength, _
lpFileSystemFlags, _
lpszFileSystemNameBuffer, _
nFileSystemNameSize)

GetVolumeSerialNumber = Hex$(lpVolumeSerialNumber)

End Function

Private Sub Command1_Click()
Dim sRetVal As String

sRetVal = GetVolumeSerialNumber("C:\")

MsgBox "VolumeSerialNumber is: " & sRetVal

End Sub

只需在窗体建一个COMMAND1。
温馨提示:答案为网友推荐,仅供参考
第1个回答  2008-07-16
上QQ,我传给你现成的吧