AU3程序加个使用期限

dim $deathdate="2010-01-29",$now=@YEAR&"-"&@MON& "-" & @MDAY
$result = StringCompare($deathdate,$now,1)
If $result<>0 Then
 MsgBox(16,"您的试用期已过!","请购买正版软件!谨防盗版使用!",3)
 Exit
 EndIf 
 ;软件主体
 MsgBox(16,"试用期!","请购买正版软件!",3)

上面讲到的是对于软件使用限制
不过这个是通过AutoIt自身所带的时间宏取的本地时间
这样做出的程序,哪怕是加了时间限制也没用,只要用户修改下本地时间就行了
在里面楼主提到了取网络验证,因此我在自己程序上面加了段代码测试了下
现在发在这里和大家分享下。希望对大家能够有用。

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <IE.au3>
TraySetState (2 ) 
_IEErrorHandlerRegister ()
$oIE = _IECreateEmbedded ()
$Form1 =GUICreate("程序时间限制测试", 180, 50)
$GUIActiveX = GUICtrlCreateObj($oIE, 0, 1, 150, 50)
dim $deathdate="2010-01-29",$now=@YEAR&"-"&@MON& "-" & @MDAY

$result = StringCompare($deathdate,$now,1)

GUISetState() ;Show GUI
_IENavigate ($oIE, "http://www.timedate.cn/worldclock/ti.asp")
$sText = _IEBodyReadText ($oIE)
Sleep(1000)
dim $deathdate="2022年01月29日",$now=$sText
$result = StringCompare($deathdate,$now,1)
If $result<0 Then
MsgBox(16,"软件试用期已过!","请到www.wm0739.cn下载最新版本!",3)
Exit
EndIf 
;软件主体
MsgBox(64,"温馨提示!","程序启动成功",3)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

EndSwitch
WEnd
© 版权声明
THE END
喜欢就支持一下吧
点赞10 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容