-为保证文章完整性,谢绝对某篇而非全部手记的转载(mi6236)
Option Explicit
Private 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 '等到某一磁盘分区的信息
'************注册窗体*****************
’运用另一个***.mdb来控制软件是否超出试用期
Private Sub Form_Load()
'根据C盘序列号得到原ID
Dim Driver, VolName, Fsys As String
Dim volNumber, MCM, FSF As Long
Driver = "c:"
Dim res As Long
Dim localid As Long
res = GetVolumeInformation(Driver, VolName, 127, volNumber, MCM, FSF, Fsys, 127)
'将c盘序列号加密并显示在注册窗体的本机码中
localid = *****volNumber***** '加密算法
Text1.Text = localid'显示经加密后的本机码
End Sub
Private Sub cancel_Click()
On Error GoTo error
'检测系统文件夹是否有***.mdb文件,如果没有,则是系统第一次安装,建立此数据库文件
If Dir(sPath & "***.**") = "" Then
Dim ws As Workspace
Dim db As Database