Новый участник
Сообщения: 44
Благодарности: 4
|
Профиль
|
Отправить PM
| Цитировать
Tukash,
Чтобы еще показывало сколько места свободно на HDD, то вот:
код
Код:
type
TProc = procedure(HandleW, msg, idEvent, TimeSys: LongWord);
var
WelcomeLabel1,WelcomeLabel2,FinishedHeadingLabel,RunLabel,
FinishedLabel,PageNameLabel,PageDescriptionLabel:TLabel;
RunMyProg: TCheckBox;
TimerID: LongWord;
currTime: Integer;
SplashImage: TBitmapImage;
NeedSize:Integer;
FreeMB, TotalMB: Cardinal;
NeedSpaceLabel,FreeSpaceLabel: TLabel;
function WrapTimerProc(callback:TProc; paramcount:integer):longword;
external 'wrapcallback@files:InnoCallback.dll stdcall';
function SetTimer(hWnd: LongWord; nIDEvent, uElapse: LongWord; lpTimerFunc: LongWord): LongWord;
external 'SetTimer@user32.dll stdcall';
function KillTimer(hWnd: LongWord; nIDEvent: LongWord): LongWord;
external 'KillTimer@user32.dll stdcall';
procedure OnTimer(HandleW, msg, idEvent, TimeSys: LongWord);
begin
currTime := currTime + 1;
case currTime of
1{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\2.bmp')) end;
2{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\3.bmp')) end;
3{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\4.bmp')) end;
4{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\5.bmp')) end;
5{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\6.bmp')) end;
6{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\7.bmp')) end;
7{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\8.bmp')) end;
8{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\9.bmp')) end;
end;
if CurrTime = 2*{#TIME_FOR_VIEW} then CurrTime := -1;
end;
procedure GetFreeSpaceCaption(Sender: TObject);
var
Path: String;
begin
Path := ExtractFileDrive(WizardForm.DirEdit.Text);
GetSpaceOnDisk(Path, True, FreeMB, TotalMB);
if FreeMB > 1024 then
FreeSpaceLabel.Caption := 'Доступно места на диске: '+ FloatToStr(round(FreeMB/1024*100)/100) + ' GB' else
FreeSpaceLabel.Caption := 'Доступно места на диске: '+ IntToStr(FreeMB)+ ' MB';
if FreeMB < NeedSize then
WizardForm.NextButton.Enabled := False else
WizardForm.NextButton.Enabled := True; end;
procedure GetNeedSpaceCaption;
begin
if NeedSize > 1024 then
NeedSpaceLabel.Caption := 'Требуется места на диске: '+ FloatToStr(round(NeedSize/1024*100)/100) + ' GB' else
NeedSpaceLabel.Caption := 'Требуется места на диске: '+ IntToStr(NeedSize)+ ' MB';
end;
procedure RLabelOnClick(Sender: TObject);
begin
if RunMyProg.Checked=false then
begin
RunMyProg.Checked := true;
end else
RunMyProg.Checked := false;
end;
// ôóíêöèÿ äëÿ çàïóñêà ïðîãðàììû åñëè îòìå÷åí ÷åáîêñ
procedure CurStepChanged(CurStep: TSetupStep);
var
ErrorCode: Integer;
begin
if CurStep = ssDone then
begin
end;
end;
procedure InitializeWizard();
begin
ExtractTemporaryFile('1.bmp')
ExtractTemporaryFile('2.bmp')
ExtractTemporaryFile('3.bmp')
ExtractTemporaryFile('4.bmp')
ExtractTemporaryFile('5.bmp')
ExtractTemporaryFile('6.bmp')
ExtractTemporaryFile('7.bmp')
ExtractTemporaryFile('8.bmp')
ExtractTemporaryFile('9.bmp')
currTime := 0;
WizardForm.WelcomeLabel1.Hide;
WizardForm.WelcomeLabel2.Hide;
WizardForm.PageNameLabel.Hide;
WizardForm.PageDescriptionLabel.Hide;
WizardForm.FinishedHeadingLabel.Hide;
WizardForm.FinishedLabel.Hide;
// íèçíàþ ïî÷åìó, íî Hide íå äåéñòâóåò. Ïîýòîìó ïðîñòî óìåíüøèë ðàçìåð
WizardForm.RunList.Height := 0;
WizardForm.RunList.Width := 0;
WizardForm.FilenameLabel.Hide;
WizardForm.StatusLabel.Parent := WizardForm;
WizardForm.StatusLabel.Top := ScaleY(315);
WizardForm.StatusLabel.Left := ScaleX(10);
WizardForm.StatusLabel.Width := ScaleX(200);
WizardForm.StatusLabel.Hide;
WizardForm.ProgressGauge.Parent := WizardForm;
WizardForm.ProgressGauge.Top := ScaleY(330);
WizardForm.ProgressGauge.Left := ScaleX(10);
WizardForm.ProgressGauge.Width := ScaleX(380);
WizardForm.ProgressGauge.Height := ScaleX(18);
WizardForm.ProgressGauge.Hide;
SplashImage := TBitmapImage.Create(WizardForm);
SplashImage.Top := 0;
SplashImage.Left := 0;
SplashImage.Width := WizardForm.MainPanel.Width;
SplashImage.Height := WizardForm.Bevel.Top;
SplashImage.Parent := WizardForm.InnerPage;
SplashImage.Stretch := True;
SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\1.bmp'));
SplashImage.Hide;
WizardForm.WizardBitmapImage.Align:=true;
WizardForm.WizardBitmapImage2.Align:=true;
WizardForm.WizardSmallBitmapImage.Align:=true;
WelcomeLabel1:=TLabel.Create(WizardForm);
WelcomeLabel1.Left:=ScaleX(150);
WelcomeLabel1.Top := ScaleY(15);
WelcomeLabel1.Width := ScaleX(320);
WelcomeLabel1.Height := ScaleY(75);
WelcomeLabel1.AutoSize := False;
WelcomeLabel1.WordWrap := True;
WelcomeLabel1.Font.Color := clBlack;
// çäåñü ìîæíî ïîèãðàòü øðèôòîì
// WelcomeLabel1.Font.Style := [fsBold];
// WelcomeLabel1.Font.Name:='MS Sans Serif';
WelcomeLabel1.Font.Size := 25;
WelcomeLabel1.Transparent := True;
WelcomeLabel2:=TLabel.Create(WizardForm);
WelcomeLabel2.Left := ScaleX(150);
WelcomeLabel2.Top := ScaleY(90);
WelcomeLabel2.Width := ScaleX(320);
WelcomeLabel2.Height := ScaleY(200);
WelcomeLabel2.AutoSize := False;
WelcomeLabel2.WordWrap := True;
WelcomeLabel2.Font.Color := clred;
WelcomeLabel2.Font.Size := 12;
WelcomeLabel2.Transparent := True;
PageNameLabel := TLabel.Create(WizardForm);
PageNameLabel.Left := ScaleX(25);
PageNameLabel.Top := ScaleY(10);
PageNameLabel.Width := ScaleX(300);
PageNameLabel.Height := ScaleY(14);
PageNameLabel.AutoSize := False;
PageNameLabel.WordWrap := True;
PageNameLabel.Font.Color := clRed;
PageNameLabel.Font.Style := [fsBold];
PageNameLabel.Transparent := True;
PageDescriptionLabel := TLabel.Create(WizardForm);
PageDescriptionLabel.Left := ScaleX(40);
PageDescriptionLabel.Top := ScaleY(25);
PageDescriptionLabel.Width := ScaleX(475);
PageDescriptionLabel.Height := ScaleY(30);
PageDescriptionLabel.AutoSize := False;
PageDescriptionLabel.WordWrap := True;
PageDescriptionLabel.Font.Color := clBlack;
PageDescriptionLabel.Transparent := True;
FinishedHeadingLabel:=TLabel.Create(WizardForm);
FinishedHeadingLabel.Left := ScaleX(150);
FinishedHeadingLabel.Top := ScaleY(15);
FinishedHeadingLabel.Width := ScaleX(320);
FinishedHeadingLabel.Height := ScaleY(75);
FinishedHeadingLabel.AutoSize := False;
FinishedHeadingLabel.WordWrap := True;
FinishedHeadingLabel.Font.Color := clRED;
// çäåñü òîæå ìîæíî ïîèãðàòü øðèôòîì
// FinishedHeadingLabel.Font.Style := [fsBold];
FinishedHeadingLabel.Font.Name:='Segoe UI';
FinishedHeadingLabel.Font.Size := 14;
FinishedHeadingLabel.Transparent := True;
FinishedLabel:=TLabel.Create(WizardForm);
FinishedLabel.Left := ScaleX(150);
FinishedLabel.Top := ScaleY(90);
FinishedLabel.Width := ScaleX(320);
FinishedLabel.Height := ScaleY(200);
FinishedLabel.AutoSize := False;
FinishedLabel.WordWrap := True;
FinishedLabel.Font.Color := clBlack;
FinishedLabel.Font.Size := 12;
FinishedLabel.Transparent := True;
begin
NeedSize :=3800;
WizardForm.DiskSpaceLabel.Hide;
NeedSpaceLabel := TLabel.Create(WizardForm);
with NeedSpaceLabel do
begin
Parent := WizardForm.SelectDirPage;
Left := ScaleX(0);
Top := ScaleY(202);
Width := ScaleX(209);
Height := ScaleY(13);
end;
FreeSpaceLabel := TLabel.Create(WizardForm);
with FreeSpaceLabel do
begin
Parent := WizardForm.SelectDirPage;
Left := ScaleX(0);
Top := ScaleY(220);
Width := ScaleX(209);
Height := ScaleY(13);
end;
WizardForm.DirEdit.OnChange := @GetFreeSpaceCaption;
WizardForm.DirEdit.Text := WizardForm.DirEdit.Text + #0;
end;
end;
procedure CurPageChanged(CurPageID: Integer);
var
pfunc: LongWord;
begin
if CurPageID=wpSelectDir then begin
WizardForm.NextButton.Caption:='Далее >';
GetNeedSpaceCaption;
if FreeMB < NeedSize then
WizardForm.NextButton.Enabled:=False
end;
begin
WelcomeLabel1.Caption := WizardForm.WelcomeLabel1.Caption;
WelcomeLabel2.Caption := WizardForm.WelcomeLabel2.Caption;
PageNameLabel.Caption := WizardForm.PageNameLabel.Caption;
PageDescriptionLabel.Caption := WizardForm.PageDescriptionLabel.Caption;
FinishedHeadingLabel.Caption := WizardForm.FinishedHeadingLabel.Caption;
FinishedLabel.Caption := WizardForm.FinishedLabel.Caption;
// çäåñü ïðèä¸òñÿ âðó÷íóþ ââîäèòü òðåáóåìûé òåêñò
//RunLabel.Caption := 'Çàïóñòèòü ïðîãðàììó';
if (CurPageID = wpInstalling) then
begin
pfunc := WrapTimerProc(@OnTimer, 4);
TimerID := SetTimer(0, 0, 1000, pfunc);
WizardForm.InnerNotebook.Hide;
WizardForm.Bevel1.Hide;
WizardForm.MainPanel.Hide;
WizardForm.PageNameLabel.Hide;
WizardForm.PageDescriptionLabel.Hide;
WizardForm.ProgressGauge.Show;
WizardForm.StatusLabel.Show;
SplashImage.Show;
end
else
begin
WizardForm.ProgressGauge.Hide;
WizardForm.StatusLabel.Hide;
SplashImage.Hide;
if (CurPageID > wpInstalling) and (CurPageID < wpFinished) then
begin
WizardForm.InnerNotebook.Show;
WizardForm.Bevel1.Show;
WizardForm.MainPanel.Show;
WizardForm.PageNameLabel.Show;
WizardForm.PageDescriptionLabel.Show;
end;
end;
end;
end;
procedure DeinitializeSetup();
begin
KillTimer(0, TimerID);
end;
|
Отправлено: 13:12, 01-07-2009
| #1054
|