[Setup] AppName=date.time.beveledlabel.am.pm AppVerName=date.time.beveledlabel.am.pm DefaultDirName={pf}\date.time.beveledlabel.am.pm OutputBaseFilename=date.time.beveledlabel.am.pm.by.genri ;Язык всех диалогов в инсталляторе: [Languages] Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl" [Messages] BeveledLabel=Name of program [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; |