Angel_Smerti Цитата: как этот коктейль соединить?
-так [more]
[_Code]
type
TSystemTime = record
wYear, wMonth, wDayOfWeek, wDay, wHour, wMinute, wSecond, wMilliseconds: Word;
end;
function sndPlaySound(lpszSoundName: string; uFlags: cardinal):integer;
external 'sndPlaySoundA@winmm.dll stdcall';
procedure LoadSkin(lpszPath: String; lpszIniFileName: String);
external 'LoadSkin@files:isskin.dll stdcall';
procedure UnloadSkin();
external 'UnloadSkin@files:isskin.dll stdcall';
function ShowWindow(hWnd: Integer; uType: Integer): Integer;
external 'ShowWindow@user32.dll stdcall';
function GetLocalTime(var lpTime: TSystemTime): Boolean;
external 'GetLocalTime@kernel32.dll stdcall';
var
StartTime, Time: TSystemTime;
LabelW: TNewStaticText;
ProgressLabel: TLabel;
function GetWorkTime: String;
begin
GetLocalTime(Time);
if Time.wHour < StartTime.wHour then
begin
Time.wHour := 24 - StartTime.wHour + Time.wHour
end else
begin
Time.wHour := Time.wHour - StartTime.wHour
end
if Time.wMinute < StartTime.wMinute then
begin
Time.wMinute := 60 - StartTime.wMinute + Time.wMinute
Time.wHour := Time.wHour - 1
end else
begin
Time.wMinute := Time.wMinute - StartTime.wMinute
end
if Time.wSecond < StartTime.wSecond then
begin
Time.wSecond := 60 - StartTime.wSecond + Time.wSecond
Time.wMinute := Time.wMinute - 1
end else
begin
Time.wSecond := Time.wSecond - StartTime.wSecond
end
if Time.wMilliseconds < StartTime.wMilliseconds then
begin
Time.wMilliseconds := 1000 - StartTime.wMilliseconds + Time.wMilliseconds
Time.wSecond := Time.wSecond - 1
end else
begin
Time.wMilliseconds:= Time.wMilliseconds - StartTime.wMilliseconds
end
Result := 'Длительность: ' + IntToStr(Time.wHour) + ' час, ' + IntToStr(Time.wMinute) + ' мин, ' + FloatToStr((Time.wSecond*1000 + Time.wMilliseconds)/1000) + ' сек.'
end;
procedure ExtLog();
begin
with WizardForm.ProgressGauge do
begin
ProgressLabel.Caption := IntToStr((Position-Min)/((Max - Min)/100)) + '%'
end;
end;
function InitializeSetup: Boolean;
begin
ExtractTemporaryFile('VistaVGUltimate.cjstyles');
LoadSkin(ExpandConstant('{tmp}\VistaVGUltimate.cjstyles'), 'NormalAero32.ini');
Result := True;
if RegKeyExists(HKLM, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{#SetupSetting("AppName")}_is1')
or RegKeyExists(HKLM, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{80DB2577-43E3-4C34-00AF-0D7967B942C9}') then
begin
Result := true;
end else
begin
MsgBox('{#SetupSetting("AppName")} не найдена!', mbInformation, mb_Ok);
Result := False;
Exit;
end;
ExtractTemporaryFile('click.wav');
Result := True;
end;
procedure DeinitializeSetup();
begin
ShowWindow(StrToInt(ExpandConstant('{wizardhwnd}')), 0);
UnloadSkin();
end;
function NextButtonClick(CurPageID: Integer): Boolean;
begin
sndPlaySound(ExpandConstant('{tmp}\click.wav'), $0001);
Result := True;
end;
function BackButtonClick(CurPageID: Integer): Boolean;
begin
sndPlaySound(ExpandConstant('{tmp}\click.wav'), $0001);
Result := True;
end;
procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
begin
sndPlaySound(ExpandConstant('{tmp}\click.wav'), $0001);
end;
function DirBrowseButtonClick(CurPageID: Integer): Boolean;
begin
sndPlaySound(ExpandConstant('{tmp}\click.wav'), $0001);
Result := True;
end;
function GroupBrowseButtonClick(CurPageID: Integer): Boolean;
begin
sndPlaySound(ExpandConstant('{tmp}\click.wav'), $0001);
Result := True;
end;
procedure InitializeWizard;
begin
WizardForm.DirBrowseButton.Enabled := False;
WizardForm.DirEdit.Enabled := False;
GetLocalTime(StartTime);
LabelW := TNewStaticText.Create(WizardForm);
LabelW.Top := WizardForm.CancelButton.Top;
LabelW.Left := WizardForm.ClientWidth - WizardForm.CancelButton.Left - WizardForm.CancelButton.Width;
LabelW.Parent := WizardForm;
LabelW.Caption := 'Время старта: ' + IntToStr(StartTime.wHour) + ' час, ' + IntToStr(StartTime.wMinute) + ' мин, ' + FloatToStr((StartTime.wSecond*1000 + StartTime.wMilliseconds)/1000) + ' сек.' ;
ProgressLabel := TLabel.Create(WizardForm);
with WizardForm.ProgressGauge do
begin
ProgressLabel.Top := ScaleY(4);
ProgressLabel.Left := ScaleX(180);
ProgressLabel.Caption := '0%';
ProgressLabel.AutoSize := True;
ProgressLabel.Font.Color := clWindowText;
ProgressLabel.Font.Style := [fsBold];
ProgressLabel.Transparent := True;
ProgressLabel.Parent := WizardForm.ProgressGauge;
end;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID = wpInstalling then
begin
WizardForm.MainPanel.Visible := False;
WizardForm.Bevel1.Visible := False;
WizardForm.Width := ScaleX(395);
WizardForm.Height := ScaleY(142);
WizardForm.Left := ScaleX(0);
WizardForm.Top := ScaleY(0);
WizardForm.InnerNotebook.Left := ScaleX(10);
WizardForm.InnerNotebook.Top := ScaleY(10);
WizardForm.InnerNotebook.Width := ScaleX(370);
WizardForm.StatusLabel.Left := ScaleX(0);
WizardForm.StatusLabel.Top := ScaleY(0);
WizardForm.StatusLabel.Width := WizardForm.InnerNotebook.Width;
WizardForm.FileNameLabel.Left := ScaleX(0);
WizardForm.FileNameLabel.Top := ScaleY(20);
WizardForm.FileNameLabel.Width := WizardForm.InnerNotebook.Width;
WizardForm.ProgressGauge.Top := ScaleY(40);
WizardForm.ProgressGauge.Width := WizardForm.InnerNotebook.Width;
WizardForm.CancelButton.Left := ScaleX(154);
WizardForm.CancelButton.Top := ScaleY(80);
WizardForm.CancelButton.BringToFront;
end
if CurPageID=wpFinished then
begin
LabelW.Caption := LabelW.Caption + #13#10 + GetWorkTime;
WizardForm.Width:= ScaleX(502);
WizardForm.Height:= ScaleY(392);
WizardForm.Position := poScreenCenter;
end;
end;
[/more]