如何存储日期和注册表中安装时间
2009-11-07 09:20
218 查看
;
; ISX 3.0.6
;
;
[Setup]
AppName=DateTimeReg
AppVerName=DateTimeReg
Uninstallable=false
UpdateUninstallLogAppName=false
DisableDirPage=true
DisableProgramGroupPage=true
DefaultDirName={pf}\DateTimeReg
DisableStartupPrompt=true
[Registry]
Root: HKLM; Subkey: Software\MyCompany\MyProgram; ValueType: string; ValueName: DateTimeInstall; ValueData: {code:GetMyStringNow|''}
[_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 GetSystemTime(var lpSystemTime: TSystemTime); external
'GetSystemTime@kernel32.dll';
procedure GetLocalTime(var lpSystemTime: TSystemTime); external
'GetLocalTime@kernel32.dll';
// variable to store date time infos
var
st, lt: TSystemTime;
function FormatDateTime( dt: TSystemTime ) : String;
begin
Result := IntToStr( dt.wDay )+'/'+IntToStr( dt.wMonth )+'/'+IntToStr( dt.wYear ) +
' '+IntToStr( dt.wHour )+':'+IntToStr( dt.wMinute )+'.'+IntToStr( dt.wSecond );
end;
function FormatANSI( dt: TSystemTime ) : String;
var s: String;
begin
Result := IntToStr( dt.wYear );
s := IntToStr( dt.wMonth ); if length(s) = 1 then s := '0' + s;
Result := Result + s;
s := IntToStr( dt.wDay ); if length(s) = 1 then s := '0' + s;
Result := Result + s;
s := IntToStr( dt.wHour ); if length(s) = 1 then s := '0' + s;
Result := Result + s;
s := IntToStr( dt.wMinute ); if length(s) = 1 then s := '0' + s;
Result := Result + s;
s := IntToStr( dt.wSecond ); if length(s) = 1 then s := '0' + s;
Result := Result + s;
end;
function GetMyStringNow( s : String ) : String;
begin
Result := FormatANSI( lt );
end;
function InitializeSetup: Boolean;
var
s, crlf: string;
begin
crlf := #13#10;
GetSystemTime(st);
GetLocalTime(lt);
s := 'System Time is : ' + crlf +
FormatDateTime( st ) + crlf + crlf +
'Local Time is : ' + crlf +
FormatDateTime( lt );
// just to show datetime infos
MsgBox( s ,mbInformation, MB_OK );
Result := true;
end;本文出自 “学无止境” 博客,请务必保留此出处http://dqk1985.blog.51cto.com/1005868/223406
; ISX 3.0.6
;
;
[Setup]
AppName=DateTimeReg
AppVerName=DateTimeReg
Uninstallable=false
UpdateUninstallLogAppName=false
DisableDirPage=true
DisableProgramGroupPage=true
DefaultDirName={pf}\DateTimeReg
DisableStartupPrompt=true
[Registry]
Root: HKLM; Subkey: Software\MyCompany\MyProgram; ValueType: string; ValueName: DateTimeInstall; ValueData: {code:GetMyStringNow|''}
[_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 GetSystemTime(var lpSystemTime: TSystemTime); external
'GetSystemTime@kernel32.dll';
procedure GetLocalTime(var lpSystemTime: TSystemTime); external
'GetLocalTime@kernel32.dll';
// variable to store date time infos
var
st, lt: TSystemTime;
function FormatDateTime( dt: TSystemTime ) : String;
begin
Result := IntToStr( dt.wDay )+'/'+IntToStr( dt.wMonth )+'/'+IntToStr( dt.wYear ) +
' '+IntToStr( dt.wHour )+':'+IntToStr( dt.wMinute )+'.'+IntToStr( dt.wSecond );
end;
function FormatANSI( dt: TSystemTime ) : String;
var s: String;
begin
Result := IntToStr( dt.wYear );
s := IntToStr( dt.wMonth ); if length(s) = 1 then s := '0' + s;
Result := Result + s;
s := IntToStr( dt.wDay ); if length(s) = 1 then s := '0' + s;
Result := Result + s;
s := IntToStr( dt.wHour ); if length(s) = 1 then s := '0' + s;
Result := Result + s;
s := IntToStr( dt.wMinute ); if length(s) = 1 then s := '0' + s;
Result := Result + s;
s := IntToStr( dt.wSecond ); if length(s) = 1 then s := '0' + s;
Result := Result + s;
end;
function GetMyStringNow( s : String ) : String;
begin
Result := FormatANSI( lt );
end;
function InitializeSetup: Boolean;
var
s, crlf: string;
begin
crlf := #13#10;
GetSystemTime(st);
GetLocalTime(lt);
s := 'System Time is : ' + crlf +
FormatDateTime( st ) + crlf + crlf +
'Local Time is : ' + crlf +
FormatDateTime( lt );
// just to show datetime infos
MsgBox( s ,mbInformation, MB_OK );
Result := true;
end;本文出自 “学无止境” 博客,请务必保留此出处http://dqk1985.blog.51cto.com/1005868/223406
相关文章推荐
- 如何设置安装程序的日期时间限制
- IAR开发STM8,如何加入每次编译的日期时间信息来做为版本信息
- mysql如何求得两个日期的天数以及linux下获取时间
- Extjs4如何处理后台json数据中日期和时间
- sql server 里如何取得服务器的日期和时间,并以自定义的格式插入数据库?
- C# 如何获取当前日期和时间
- 日期和时间的存储与处理
- 在C语言中如何处理时间和日期
- MS SQL Server 2000中用于日期时间存储数据类型说明
- sqlserver中如何提取datetime格式数据中的日期或时间?
- win7系统安装时间怎么查询 如何知道win7系统的安装时间
- PHP+Mysql日期时间如何转换(UNIX时间戳和格式化日期)
- mysql 获取时间日期后,如何在数据库里去掉小数点后面的零
- Java如何保存含有时间的日期到Oracle数据库
- Python:如何获取当前的日期和时间
- 42.Oracle数据库SQL开发之 日期和时间的存储与处理——Oracle对2位年份处理
- js如何取当前日期时间/格式为:yyyy-mm-dd hh:mm:ss
- Android 时间选择器,如何让日期和时间显示成滚动样式
- 【2011.09.01】如何使用javaScript代码获取系统时间和日期?
- 如何安装配置IBM存储多路径软件