以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  请版主帮助分析,莫名其妙的错误  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=33751)

--  作者:包头123
--  发布时间:2013/5/23 16:51:00
--  请版主帮助分析,莫名其妙的错误
版主:帮我分析一下,下面的语句哪里有错误。5月11日之前执行的很好,自从升级到5月11日版本后,就出现错误。
语句:
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

--  作者:Bin
--  发布时间:2013/5/23 17:02:00
--  
例子发出来看看.
--  作者:包头123
--  发布时间:2013/5/23 17:04:00
--  
我刚才测试了一下,下面的语句有问题:

Messagebox.Show("DecryptText(Code,abc,abc) = " & DecryptText(Code,"abc","abc"))

你给看看,这是狐表提供的例子。

--  作者:Bin
--  发布时间:2013/5/23 17:06:00
--  
这个语句是没有问题的.如果有问题.说明你  CODE变量的值有问题.
--  作者:包头123
--  发布时间:2013/5/23 17:07:00
--  
版主:
   下面是你们帮助中提供的例子,也是同样的错误。

Dim n As Integer = GetConfigValue("Count",1)
Dim
Code As String = GetConfigValue("Register" & ComputerId,"")
Dim
Ok As Boolean
If
Code > "" AndAlso DecryptText(Code,"abc","abc") = ComputerId Then \'如果注册码正确
    OK =
True
Else
    If
n > 30 Then
        Forms(
"注册").Open()
        Code = GetConfigValue(
"Register" & ComputerId,"")
        If
Code > "" AndAlso DecryptText(Code,"abc","abc") = ComputerId Then \'如果注册码正确
            OK =
True
        End
If
    End
If
    If
n > 60 AndAlso Ok = False Then
        Messagebox.Show(
"您正在使用的产品已经超出试用次数!")
        Syscmd.Project.
Exit()
    End
If
End
If
n = n +
1
SaveConfigValue(
"Count",n)


你们自己测试一下,看看到底哪里出错了。以前执行的好好的,升级到5.18日版本后就出现错误了。


--  作者:Bin
--  发布时间:2013/5/23 17:15:00
--  
我测试都没问题的啊,方便的话把例子发出来看一下.
--  作者:包头123
--  发布时间:2013/5/23 17:32:00
--  
我是在win8下面测试的。这段语句放在命令窗口中就无法执行。
--  作者:包头123
--  发布时间:2013/5/23 17:33:00
--  
你们的例子是可以单独执行的,我在5.11日之前的版本就执行过没有问题,现在却不行了。


--  作者:包头123
--  发布时间:2013/5/24 10:49:00
--  
你们的例子是可以单独执行的,我在5.11日之前的版本就执行过没有问题,现在却不行了。

--  作者:XYT
--  发布时间:2013/5/24 11:01:00
--  
先升级518再测试下