Dim Count As Integer
Count = Registry.GetValue("HKEY_CURRENT_USER\\Software\\MyApp","Count",0)
Registry.SetValue("HKEY_CURRENT_USER\\Software\\MyApp","Count",Count + 1)
Dim n As Integer = GetConfigValue("Count",1)
Dim Code As String = GetConfigValue("Register" & ComputerId,"")
Dim Ok As Boolean
If Code > "" AndAlso DecryptText(Code,"lxl","yt#") = ComputerId Then \'如果注册码正确
OK = True
Else
If n > 2 Then
msgbox(ComputerId)
Forms("注册").Open()
msgbox(ComputerId)
Code = GetConfigValue("Register" & ComputerId,"")
If Code > "" AndAlso DecryptText(Code,"***","***") = ComputerId Then \'如果注册码正确
OK = True
End If
End If
If n > 10 AndAlso Ok = False Then
Messagebox.Show("您正在使用的产品已经超出试用次数!")
Syscmd.Project.Exit()
End If
End If
n = n + 1
SaveConfigValue("Count",n)
e.Form.Controls("TextBox1").Value = ComputerId
e.Form.Controls("TextBox2").Value = GetConfigValue("Register" & ComputerId, "")