如何设置安装程序的日期时间限制
2009-11-07 09:20
477 查看
;
[Setup]
AppName=DateTimeStop
AppVerName=DateTimeStop
Uninstallable=false
UpdateUninstallLogAppName=false
DisableDirPage=true
DisableProgramGroupPage=true
DefaultDirName={pf}\DateTimeStop
DisableStartupPrompt=true
[_ISTool]
EnableISX=true
[Code]
type
TSystemTime = record
wYear : Word;
wMonth : Word;
wDayOfWeek : Word;
wDay : Word;
wHour : Word;
wMinute : Word;
wSecond : Word;
wMilliseconds : Word;
end;
procedure GetLocalTime(var lpSystemTime: TSystemTime); external
'GetLocalTime@kernel32.dll';
//
// compare dt1 and dt2, return false id dt1 is lower than dt2
// thanks to Bruno Gellweiler that provide a working function :)
function IsOKDateTime( dt1, dt2: TSystemTime ) : Boolean;
begin
Result := true;
if dt2.wYear < dt1.wYear then
result := false
else if dt2.wYear = dt1.wYear then
if dt2.wMonth < dt1.wMonth then
result := false
else if dt2.wMonth = dt1.wMonth then
if dt2.wDay < dt1.wDay then
result := false ;
end;
function InitializeSetup: Boolean;
var
lt, datelimit: TSystemTime;
s, crlf: string;
begin
crlf := #13#10;
// let's say it is not allowed to install after 1 May 2003
datelimit.wYear := 2003;
datelimit.wMonth := 5;
datelimit.wDay := 1;
GetLocalTime(lt);
Result := IsOKDateTime( lt, datelimit );
s := 'Install time limit, it is not possible to install this program.';
if not Result then
// just to show datetime infos
MsgBox( s , mbError, MB_OK );
end;本文出自 “学无止境” 博客,请务必保留此出处http://dqk1985.blog.51cto.com/1005868/223407
[Setup]
AppName=DateTimeStop
AppVerName=DateTimeStop
Uninstallable=false
UpdateUninstallLogAppName=false
DisableDirPage=true
DisableProgramGroupPage=true
DefaultDirName={pf}\DateTimeStop
DisableStartupPrompt=true
[_ISTool]
EnableISX=true
[Code]
type
TSystemTime = record
wYear : Word;
wMonth : Word;
wDayOfWeek : Word;
wDay : Word;
wHour : Word;
wMinute : Word;
wSecond : Word;
wMilliseconds : Word;
end;
procedure GetLocalTime(var lpSystemTime: TSystemTime); external
'GetLocalTime@kernel32.dll';
//
// compare dt1 and dt2, return false id dt1 is lower than dt2
// thanks to Bruno Gellweiler that provide a working function :)
function IsOKDateTime( dt1, dt2: TSystemTime ) : Boolean;
begin
Result := true;
if dt2.wYear < dt1.wYear then
result := false
else if dt2.wYear = dt1.wYear then
if dt2.wMonth < dt1.wMonth then
result := false
else if dt2.wMonth = dt1.wMonth then
if dt2.wDay < dt1.wDay then
result := false ;
end;
function InitializeSetup: Boolean;
var
lt, datelimit: TSystemTime;
s, crlf: string;
begin
crlf := #13#10;
// let's say it is not allowed to install after 1 May 2003
datelimit.wYear := 2003;
datelimit.wMonth := 5;
datelimit.wDay := 1;
GetLocalTime(lt);
Result := IsOKDateTime( lt, datelimit );
s := 'Install time limit, it is not possible to install this program.';
if not Result then
// just to show datetime infos
MsgBox( s , mbError, MB_OK );
end;本文出自 “学无止境” 博客,请务必保留此出处http://dqk1985.blog.51cto.com/1005868/223407
相关文章推荐
- centos6.5源码安装和centos7.2使用yum安装httpd后,如何添加模块;以及怎么设置Cache-Control:max-age=?浏览器缓存时间
- 【abap】如何在abap程序中使用日期和时间
- DatePicker时间插件全解(包括各种用法,设置,日期范围限制等)
- django:DateTimeField如何自动设置为当前时间并且能被修改 ——django日期时间字段的使用
- win10正式版如何设置自动更新时间和日期?
- 如何设置 “任务依赖+时间限制”的job启动条件
- 【转】vs2008安装部署程序时如何设置程序开机启动
- centos6.5源码安装和centos7.2使用yum安装httpd后,如何添加模块;以及怎么设置Cache-Control:max-age=?浏览器缓存时间
- 如何设置SSH访问的时间限制
- 如何设置BCB编译选项才能让编译好的程序在未安装BCB的机器
- vs2008安装部署程序时如何设置程序开机启动
- 时间有些不准在Windows8中如何设置时间和日期
- 如何手动同步Chrome浏览器的设置&手动安装扩展程序
- 添加到安装程序的建立日期和时间
- 如何存储日期和注册表中安装时间
- OSS内文件如何设置为无时间限制的下载链接
- ubuntu linux 如何用命令行设置日期时间 date 和默认时区
- vs2008安装部署程序时如何设置程序开机启动?
- 如何在没有安装MFC的机器上运行程序--更改VS设置为Use MFCin a static Library
- 如何让程序显示运行时间和当前日期