如果某个日期过期,如何停止Inno-Setup安装程序?

Tam*_*fen 1 inno-setup

请让我知道如何在安装过程中检查当前日期。

我必须在安装程序脚本中嵌入某个日期,然后通知用户并停止安装过程(如果当前日期(从Windows主机获取)大于硬编码(嵌入)的日期)

谢谢

Lar*_*ars 5

使用Inno内置日期例程GetDateTimeString的替代解决方案。

[Code] 

const MY_EXPIRY_DATE_STR = '20131112'; //Date format: yyyymmdd

function InitializeSetup(): Boolean;
begin
  //If current date exceeds MY_EXPIRY_DATE_STR then return false and exit Installer.
  result := CompareStr(GetDateTimeString('yyyymmdd', #0,#0), MY_EXPIRY_DATE_STR) <= 0;

  if not result then
    MsgBox('This Software is freshware and the best-before date has been exceeded. The Program will not install.', mbError, MB_OK);
end;
Run Code Online (Sandbox Code Playgroud)