[Setup] AppName=My Program AppVerName=My Program version 1.5 DefaultDirName={pf}\My Program [Files] Source: Files\*; DestDir: {app} [Messages] BeveledLabel=My Program version 1.5 [Code] type TFileTime = record lowdatatime: longint; highdatatime: longint; end; TSystemTime = record wYear : Word; wMonth : Word; wDayOfWeek : Word; wDay : Word; wHour : Word; wMinute : Word; wSecond : Word; wMilliseconds : Word; end; function GetFileTime(hfile: longint; var lpcreation,lpaccess,lpwrite:TFileTime): boolean; external 'GetFileTime@kernel32.dll stdcall'; function FileTimeToSystemTime(var tftm: TFileTime; var systm: TSystemTime): boolean; external 'FileTimeToSystemTime@kernel32.dll stdcall'; function FileTimeToLocalFileTime( utct: TFileTime; var loct: TFileTime): boolean; external 'FileTimeToLocalFileTime@kernel32.dll stdcall'; function GetDateFormat(Locale: Integer;dwFlags: LongInt; var lpDate: TSystemTime; lpFormat: PChar; lpDateStr: String; cchDate: Integer): Integer; external 'GetDateFormatA@kernel32.dll'; function GetTimeFormat(Locale: Integer;dwFlags: LongInt; var lpTime: TSystemTime;lpFormat: PChar;lpTimeStr: String; cchDate: Integer): Integer; external 'GetTimeFormatA@kernel32.dll'; var strFile: string; strCreTime: string; strModTime: string; strAccessTime: string; function FormattedTime(t: TSystemTime) : String; var s, fmt: String; begin fmt := StringOfChar(' ',64); GetDateFormat( 0 , 0, t, 'yyyy-MM-dd' , fmt ,63); fmt := CastIntegerToString(CastStringToInteger(fmt)); s := ' -- built on ' + fmt; fmt := StringOfChar(' ',64); GetTimeFormat(0, 0, t , 'hh:mm:ss tt' , fmt ,63); fmt := CastIntegerToString(CastStringToInteger(fmt)); s := s + ' at ' + fmt; Result := s; end; function GetFileSysTime(nomef: String ; var stime: String; idx : Integer ): TSystemTime; Var fs: TFileStream; risul: TSystemTime; creat, access, write, local: TFileTime; Begin fs := TFileStream.Create(nomef,fmOpenRead); GetFileTime(fs.handle,creat,access,write); fs.Free; Case idx of 1: FileTimeToLocalFileTime(creat,local); 2: FileTimeToLocalFileTime(access,local); 3: FileTimeToLocalFileTime(write,local); end; FileTimeToSystemTime(local,risul); stime := FormattedTime(risul); Result := risul; End; procedure InitializeWizard(); var filename, s : String; t : TSystemTime; begin filename:= ExpandConstant('{srcexe}'); strFile:= filename; t := GetFileSysTime(filename, s, 1 ); strCreTime:= s; t := GetFileSysTime(filename, s, 2 ); strAccessTime:= s; t := GetFileSysTime(filename, s, 3 ); strModTime:= s; WizardForm.BeveledLabel.Caption:= WizardForm.BeveledLabel.Caption + strCreTime; end; |