1

国家安全情报局

当我安装程序时 安装日期存储在 Windows 注册表中

Section
${GetTime} "" "L" $0 $1 $2 $3 $4 $5 $6
; $0="01" day
; $1="04" month
; $2="2006" year
; $3="Friday" day of week name
; $4="16" hour
; $5="05" minute
; $6="50" seconds

WriteRegStr HKLM "Software\MyApp" "year" "$2"
WriteRegStr HKLM "Software\MyApp" "month" "$1"
WriteRegStr HKLM "Software\MyApp" "day" "$0"

${EndIf}

SectionEnd

我不知道如何运行以下命令:

从注册表继续阅读 > 计算 > 消息更新后 30 天

当您保存文件以读取时,程序将从上次记录的警告开始运行 1 个月

你能帮忙提供示例代码吗

对不起我的英语很差

请帮帮我,我是业余的

非常感谢...

4

1 回答 1

0
!include LogicLib.nsh

#support.microsoft.com/kb/188768
!define WFT_SEC 10000000
!define WFT_DAY 864000000000

var /GLOBAL installTime
var /GLOBAL expiredTime
var /GLOBAL currentTime

System::Call kernel32::GetSystemTimeAsFileTime(*l.s)
System::Call kernel32::FileTimeToLocalFileTime(*ls,*l.s)
Pop $currentTime

ReadRegStr $installTime HKCU "Software\MyCompany\MyApp" "InstallTime"
${If} $installTime = 0
    StrCpy $installTime $currentTime
    WriteRegStr HKCU "Software\MyCompany\MyApp" "InstallTime" $installTime
${EndIf}

System::Int64Op ${WFT_DAY} * 30 ; You could calculate this with calc.exe if it is always 30 days
Pop $0
System::Int64Op $installTime + $0
Pop $expiredTime


DetailPrint $$currentTime=$currentTime
DetailPrint $$installTime=$installTime
DetailPrint $$expiredTime=$expiredTime
System::Int64Op $currentTime > $expiredTime
Pop $0
DetailPrint "30 days after $$installTime: $0"
于 2013-09-07T18:51:03.550 回答