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 Global GetVal As Long |
Private Sub Form_Load() Dim TempStr1 As String * 256 Dim TempStr2 As String * 256 Dim TempLon1 As Long Dim TempLon2 As Long ……… ‘读取是否注册的信息,如何控制这里不再说明 ……… Call GetVolumeInformation("C:\", TempStr1, 256, GetVal, TempLon1, TempLon2, TempStr2, 256) Text1.Text = GetVal ‘提取本机C盘的序列号至文本框一 End Sub |
Private Sub Command1_Click() If Text2 〈〉 CStr(GetVal) Then MsgBox "注册码不正确,请认真检查输入是否正确。" Else MsgBox "你已经成功注册,请重新启动本软件。" ……… (将正确注册的信息写入,使软件功能以后不受限制。具体方法依个人爱好进行设置。) ……… End If End Sub |