YURSHAT
Advanced Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору [Setup] AppName=My Program AppVerName=My Program version 1.5 DefaultDirName={pf}\My Program [Code] type TSystemTime = record wYear, wMonth, wDayOfWeek, wDay, wHour, wMinute, wSecond, wMilliseconds: Word; end; var StartTime, Time: TSystemTime; StartFileTime, FileTime: TFileTime; TLabel: TNewStaticText; function GetLocalTime(var lpSystemTime: TSystemTime): Boolean; external 'GetLocalTime@kernel32.dll stdcall'; function SystemTimeToFileTime(const lpSystemTime: TSystemTime; var lpFileTime: TFileTime): Boolean; external 'SystemTimeToFileTime@kernel32.dll stdcall'; function FileTimeToSystemTime(const lpFileTime: TFileTime; var lpSystemTime: TSystemTime): Boolean; external 'FileTimeToSystemTime@kernel32.dll stdcall'; Function GetWorkTime: String; Begin GetLocalTime(Time) {время завершения установки} SystemTimeToFileTime(Time, FileTime) SystemTimeToFileTime(StartTime, StartFileTime) // здесь необходимо использовать 64-битовую арифметику ULARGE_INTEGER FileTime.dwLowDateTime:= FileTime.dwLowDateTime - StartFileTime.dwLowDateTime FileTime.dwHighDateTime:= FileTime.dwHighDateTime - StartFileTime.dwHighDateTime FileTimeToSystemTime(FileTime, Time) Result:= 'Длительность: ' + IntToStr(Time.wHour) + ' час, ' + IntToStr(Time.wMinute) + ' мин, ' + FloatToStr((Time.wSecond*1000 + Time.wMilliseconds)/1000) + ' сек.' End; Procedure CurPageChanged(CurPageID: Integer); Begin if CurPageID = wpFinished then TLabel.Caption:= TLabel.Caption + #13#10 + GetWorkTime; End; Procedure InitializeWizard; Begin GetLocalTime(StartTime) {время начала установки} TLabel:= TNewStaticText.Create(WizardForm); TLabel.Top:= WizardForm.CancelButton.Top; TLabel.Left:= WizardForm.ClientWidth - WizardForm.CancelButton.Left - WizardForm.CancelButton.Width; TLabel.Parent:= WizardForm; TLabel.Caption:= 'Время старта: ' + IntToStr(StartTime.wHour) + ' час, ' + IntToStr(StartTime.wMinute) + ' мин, ' + FloatToStr((StartTime.wSecond*1000 + StartTime.wMilliseconds)/1000) + ' сек.' ; End; |