如果某个日期过期,如何停止Inno-Setup安装程序? [英] How to stop Inno-Setup installer if a certain date was expired?

查看:146
本文介绍了如果某个日期过期,如何停止Inno-Setup安装程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Please let me know how to check the current date during the installation.

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

I have to embed a certain date in the installer script, and then notify the user and stop the installation process if current date (which is taken from Windows host) is bigger than hard-coded (embedded) date

谢谢

推荐答案

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

An alternative solution using Inno's built-in date routine 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;

这篇关于如果某个日期过期,如何停止Inno-Setup安装程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆