请教一下AU3时间到期的问题
dim $deathdate="2013-01-29",$now=@YEAR&"-"&@MON& "-" & @MDAY$result = StringCompare($deathdate,$now,1)
If $result<>0 Then
MsgBox(16,"您的试用期已过!","请购买正版软件!谨防盗版使用!",3)
Exit
EndIf
;软件主体
MsgBox(16,"试用期!","请购买正版软件!",3)
这个我把时间改成2013-01-29
怎么不行 要怎么修改呢 请教 dim $deathdate="20130129",$now=@YEAR&@MON&@MDAY
$result = StringCompare($deathdate,$now,1)
If $result<0 Then
MsgBox(16,"您的试用期已过!","请购买正版软件!谨防盗版使用!",3)
Exit
EndIf
;软件主体
MsgBox(16,"试用期!","请购买正版软件!",3) 回复 2# yunnl
谢谢你可以了 回复 2# yunnl
在请教一下 下面的代码中 我的代码要添加到哪里
#include <Date.au3>
$_End_date = "2012-12-21";结束日期
$_Now_date = _GetSrv_Date()
$_End_Splt = StringSplit($_End_date, "-")
$_Now_Splt = StringSplit($_Now_date, "-")
$_sDate_End = _Date_Time_EncodeFileTime($_End_Splt, $_End_Splt, $_End_Splt)
$_sDate_Now = _Date_Time_EncodeFileTime($_Now_Splt, $_Now_Splt, $_Now_Splt)
$_Compare = _Date_Time_CompareFileTime(DllStructGetPtr($_sDate_End), DllStructGetPtr($_sDate_Now))
If $_Compare = -1 Then
MsgBox(0, "", "世界末日 已经结束,谢谢支持!")
ElseIf $_Compare = 0 Then
MsgBox(0, "", "你很荣幸正在经历 世界末日!")
Else
$DateCalc = _DateDiff('d', $_Now_date, $_End_date)
MsgBox(0, "", "世界末日 将发生于 " & $_End_date & " (" & $DateCalc & "天) 后!")
EndIf
Exit
Func _GetSrv_Date()
Local $_Srvlist = ["time-nw.nist.gov", _
"time-a.nist.gov", _
"time-b.nist.gov", _
"time-a.timefreq.bldrdoc.gov", _
"time-b.timefreq.bldrdoc.gov", _
"time-c.timefreq.bldrdoc.gov", _
"utcnist.colorado.edu", _
"time.nist.gov", _
"nist1.datum.com", _
"nist1.dc.glassey.com", _
"nist1.ny.glassey.com", _
"nist1.sj.glassey.com", _
"nist1.aol-ca.truetime.com", _
"nist1.aol-va.truetime.com"]
UDPStartup()
Local $_Time_Srv
For $x = 0 To UBound($_Srvlist) - 1
$_Time_Srv = $_Srvlist[$x]
Local $Socket = UDPOpen(TCPNameToIP($_Time_Srv), 123)
If @error <> 0 Then ContinueLoop
$Status = UDPSend($Socket, MakePacket())
If $Status = 0 Then ContinueLoop
Local $Data = "", $i = 0
While $Data = ""
$i += 1
$Data = UDPRecv($Socket, 100)
If $i = 5 Then ContinueLoop (2)
Sleep(88)
WEnd
UDPCloseSocket($Socket)
UDPShutdown()
ExitLoop
Next
If $Data = "" Then Return 0
$Data = UnsignedHexToDec(StringMid($Data, 83, 8))
$Data = _DateTimeFormat(_DateAdd("s", $Data, "1900/01/01 08:00:00"), 0)
Return $Data
EndFunc ;==>_GetSrv_Date
Func MakePacket()
Local $P, $D = "1b0e01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
While $D
$P &= Chr(Dec(StringLeft($D, 2)))
$D = StringTrimLeft($D, 2)
WEnd
Return $P
EndFunc ;==>MakePacket
Func UnsignedHexToDec($_Data)
Return Dec(StringTrimRight($_Data, 1)) * 16 + Dec(StringRight($_Data, 1))
EndFunc ;==>UnsignedHexToDec 对着帮助文件去捣鼓吧
这样问来问去是问不到提升的
提供一个思路
自己看看获取到的网络时间 然后参照着上面那个 对照帮助文件里的函数说明慢慢修改
页:
[1]