以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 注册机制问题 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=133464) |
-- 作者:tuohai -- 发布时间:2019/4/15 10:23:00 -- 注册机制问题 每次启动都会启动
注册窗口,请老师指导。 Dim n As Integer = Registry.GetValue("HKEY_CURRENT_USER\\Software\\MyApp","Count",1) Dim Code As String =Registry.GetValue("HKEY_CURRENT_USER\\Software\\MyApp","Register" & ComputerId,"") Dim Ok As Boolean If Code > "" Then \'如果注册码正确 Dim str As String = DecryptText(Code,"abcd","abc") <<<<=====这里可以自己定义还是只能用ABC Dim ary() As String = str.Split(",") If ary.length = 2 AndAlso ary(1) >= Date.Now AndAlso ary(0) = ComputerId Then OK = True End If End If If ok = False Then If n > 5 Then Forms("注册码").Open() Code = Registry.GetValue("HKEY_CURRENT_USER\\Software\\MyApp","Register" & ComputerId,"") If Code > "" AndAlso DecryptText(Code,"abcd","abc") = ComputerId Then \'如果注册码正确 OK = True End If End If If n > 20 AndAlso Ok = False Then Messagebox.Show("您正在使用的产品已经超出试用次数!") Syscmd.Project.Exit() End If End If Registry.SetValue("HKEY_CURRENT_USER\\Software\\MyApp","count",n + 1)
|
-- 作者:有点甜 -- 发布时间:2019/4/15 11:00:00 -- 1、可以任意指定字符
Dim str As String = DecryptText(Code,"abcd","abc")
2、超过5次的时候,就会出现注册窗口的,你可以在命令窗口那里设置其值,重置一下,如
Registry.SetValue("HKEY_CURRENT_USER\\Software\\MyApp","count", 0)
|
-- 作者:tuohai -- 发布时间:2019/4/16 17:01:00 -- 老师本人小白,下面这段代码的红色部分实在是理解不了,请老师详解谢谢。 Dim n As Integer = Registry.GetValue("HKEY_CURRENT_USER\\Software\\MyApp","Count",1) Dim Code As String =Registry.GetValue("HKEY_CURRENT_USER\\Software\\MyApp","Register" & ComputerId,"") Dim Ok As Boolean If Code > "" Then \'如果注册码正确 Dim str As String = DecryptText(Code,"abcd","abc") Dim ary() As String = str.Split(",") If ary.length = 2 AndAlso ary(1) >= Date.Now AndAlso ary(0) = ComputerId Then OK = True End If End If If ok = False Then If n > 5 Then Forms("注册码").Open() Code = Registry.GetValue("HKEY_CURRENT_USER\\Software\\MyApp","Register" & ComputerId,"") If Code > "" AndAlso DecryptText(Code,"abcd","abc") = ComputerId Then \'如果注册码正确 OK = True End If End If If n > 20 AndAlso Ok = False Then Messagebox.Show("您正在使用的产品已经超出试用次数!") Syscmd.Project.Exit() End If End If Registry.SetValue("HKEY_CURRENT_USER\\Software\\MyApp","count",n + 1) |
-- 作者:有点甜 -- 发布时间:2019/4/16 17:30:00 -- 你注册码那里,应该是这样的字符串,如
机器码,日期时间
代码意思是,如果注册码内容个数为2,时间大于等于当前时间,机器码等于机器码,就验证通过 |
-- 作者:tuohai -- 发布时间:2019/4/23 12:35:00 -- [此贴子已经被作者于2019/4/23 14:25:24编辑过]
|
-- 作者:有点甜 -- 发布时间:2019/4/23 12:55:00 -- 加入msgbox定位出错位置
http://www.foxtable.com/webhelp/scr/1485.htm
|