Dim n As Integer = GetConfigValue("Count",1) '获取使用次数, 如果没有则设置为1
Dim Code As String = GetConfigValue("Register" & ComputerId,"") '获取注册码
Dim Ok As Boolean = False '默认设置为False
Messagebox.Show("ComputerId=" & ComputerId & ",DecryptText(Code,abc,abc) = " & DecryptText(Code,"abc","abc"))
Messagebox.Show("Code=" & Code)
If Code > "" AndAlso DecryptText(Code,"abc","abc") = ComputerId Then '如果注册码正确, 在前30次, DecryptText(Code,"abc","abc") = ComputerId 不成立 ,因此会执行else语句
OK = True
Else
If n > 5 Then '如果超过30次
Forms("注册").Open() '调用注册界面, 系统显示机器码, 并要求用户输入注册码, 如果不是设置False
Code = GetConfigValue("Register" & ComputerId,"") '或者注册码
If Code > "" AndAlso DecryptText(Code,"abc","abc") = ComputerId Then '如果注册码正确解码后 = 机器码ComputerId, 则设置OK=True
OK = True '
End If
End If
Messagebox.Show("您正在使用的产品使用次数为: " & n & " 次 !" )
If n > 7 AndAlso Ok = False Then
此主题相关图片如下:无标题.png

'如果使用次数超过60次, 并且注册码也不对, 那么就要退出. Forms("提示").Open() '使用次数超过60次, 并且注册码也不对, 则给出适当提示
'Messagebox.Show("您正在使用的产品已经超出试用次数!")
'''''''Syscmd.Project.Exit()
End If
End If
n = n + 1