'新建一个模块
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
Public Function Ghn(sd As String) As Long
On Error Resume Next
Dim sn As Long
Dim res As Long
Dim t1 As String
Dim t2 As String
t1 = String$(255, Chr$(0))
t2 = String$(255, Chr$(0))
res = GetVolumeInformation(sd, t1, Len(t1), sn, 0, 0, t2, Len(t2))
Ghn = sn
End Function
'Ghn是硬盘sd的序例号
'用一定的算法 eg:
Private Sub Form_Load()
Ghn "c:\"
ZCH= Ghn*2/3.14+2323……
'ZCH就是唯一的注册码了
End Sub