Помогите, нужно это все обьединить.
[more][Code]
const SmallWidth = 494;
var PageNameLabel, PageDescriptionLabel: TLabel;
Procedure NSISImageHeader;
Begin
PageNameLabel:= TLabel.Create(WizardForm);
with PageNameLabel do
begin
SetBounds(WizardForm.PageNameLabel.Left, WizardForm.PageNameLabel.Top, WizardForm.PageNameLabel.Width - 32, WizardForm.PageNameLabel.Height)
AutoSize:= False; WordWrap:= True; Transparent:= True;
Font.Color:= clBlack //clWhite;
Font.Style:= WizardForm.PageNameLabel.Font.Style;
Parent:= WizardForm.MainPanel;
end;
PageDescriptionLabel:= TLabel.Create(WizardForm);
with PageDescriptionLabel do
begin
SetBounds(WizardForm.PageDescriptionLabel.Left, WizardForm.PageDescriptionLabel.Top, WizardForm.PageDescriptionLabel.Width - 32, WizardForm.PageDescriptionLabel.Height)
AutoSize:= False; WordWrap:= True; Transparent:= True;
Font.Color:= clBlack //clWhite;
Parent:= WizardForm.MainPanel;
end;
WizardForm.PageNameLabel.Hide; WizardForm.PageDescriptionLabel.Hide;
WizardForm.WizardSmallBitmapImage.Left:= WizardForm.WizardSmallBitmapImage.Left - (SmallWidth - WizardForm.WizardSmallBitmapImage.Width) + 2
WizardForm.WizardSmallBitmapImage.Width:= SmallWidth
End;
Procedure CurPageChanged(CurPageID: Integer);
Begin
PageNameLabel.Caption:= WizardForm.PageNameLabel.Caption;
PageDescriptionLabel.Caption:= WizardForm.PageDescriptionLabel.Caption;
End;
Procedure InitializeWizard();
Begin
NSISImageHeader;
End;
//CD-KEY
procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
begin
if CurPageID = wpWelcome then
begin
if IsWin64 then
begin
if not RegkeyExists(HKLM, 'SOFTWARE\Wow6432Node\Electronic Arts\EA Games\Mirror''s Edge\ergc') then
begin
Confirm := False;
end;
end;
if not IsWin64 then
begin
if not RegkeyExists(HKLM, 'SOFTWARE\Wow6432Node\Electronic Arts\EA Games\Mirror''s Edge\ergc') then
begin
Confirm := False;
end;
end;
end;
end;
function NextButtonClick(CurPageID: Integer): Boolean;
var
Key: String;
ErrorCode: Integer;
begin
Result := True;
if CurPageID = wpWelcome then
begin
if IsWin64 then
begin
if not RegkeyExists(HKLM, 'SOFTWARE\Wow6432Node\Electronic Arts\EA Games\Mirror''s Edge\ergc') then
begin
WizardForm.Visible := False;
Exec(ExpandConstant('{src}\Support\Mirror''s Edge_code.exe'), '', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ErrorCode);
Result := True;
end;
end;
if not IsWin64 then
begin
if not RegkeyExists(HKLM, 'SOFTWARE\Electronic Arts\EA Games\Mirror''s Edge\ergc') then
begin
WizardForm.Visible := False;
Exec(ExpandConstant('{src}\Support\Mirror''s Edge_code.exe'), '', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ErrorCode);
Result := True;
end;
end;
if IsWin64 then
begin
if RegQueryStringValue(HKLM, 'SOFTWARE\Wow6432Node\Electronic Arts\EA Games\Mirror''s Edge\ergc', '', Key) then
begin
if Key = '' then
begin
RegDeleteKeyIncludingSubkeys(HKLM, 'SOFTWARE\Wow6432Node\Electronic Arts\EA Games\Mirror''s Edge\ergc');
end;
end;
end;
if not IsWin64 then
begin
if RegQueryStringValue(HKLM, 'SOFTWARE\Electronic Arts\EA Games\Mirror''s Edge\ergc', '', Key) then
begin
if Key = '' then
begin
RegDeleteKeyIncludingSubkeys(HKLM, 'SOFTWARE\Electronic Arts\EA Games\Mirror''s Edge\ergc');
end;
end;
end;
WizardForm.Visible := True;
if IsWin64 then
begin
if not RegkeyExists(HKLM, 'SOFTWARE\Wow6432Node\Electronic Arts\EA Games\Mirror''s Edge\ergc') then
begin
Result := False;
WizardForm.Close;
end;
end;
if not IsWin64 then
begin
if not RegkeyExists(HKLM, 'SOFTWARE\Electronic Arts\EA Games\Mirror''s Edge\ergc') then
begin
Result := False;
WizardForm.Close;
end;
end;
end;
end;
//7-zip
var
ProgressBar : TNewProgressBar;
ExtractFile:TNewStaticText;
Button1:TButton;
procedure Extract7z (hWnd, hpb, hst: THandle; fpath, extractPath, pass:pchar); external 'Extract7z@files:is7z.dll stdcall';
procedure CancelExtract; external 'CancelExtract@files:is7z.dll stdcall';
procedure InitializeWizard();
begin
ProgressBar := TNewProgressBar.Create(WizardForm);
ExtractFile:=TNewStaticText.Create(WizardForm);
with WizardForm.ProgressGauge do
begin
ProgressBar.Left := Left;
ProgressBar.Top := Top + ScaleX(55);
ProgressBar.Width := Width;
ProgressBar.Height := Height;
ProgressBar.Parent := WizardForm.InstallingPage;
ProgressBar.max := 100;
ProgressBar.Position := 0;
ExtractFile.parent:=WizardForm.InstallingPage;
ExtractFile.autosize:=false;
ExtractFile.Width := Width;
ExtractFile.top:=Top + ScaleX(35);
ExtractFile.caption:='Распаковка файлов';
end;
end;
procedure Button1OnClick(Sender: TObject);
begin
CancelExtract;
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
If CurStep=ssPostInstall then
begin
Button1:=TButton.create(WizardForm);
Button1.parent:=WizardForm;
Button1.width:=135;
Button1.caption:='Отменить распаковку';
Button1.left:=260;
Button1.top:=WizardForm.cancelbutton.top;
Button1.OnClick:=@Button1OnClick;
try
Extract7z (wizardform.handle, progressbar.handle, ExtractFile.handle, ExpandConstant('{src}') + '\1.7z', ExpandConstant('{app}'), '');
Button1.visible:=false;
except
MsgBox('Неверный пароль!', mbInformation, MB_OK);
Button1.visible:=false;
end;
end;
end;[/more]
[more][Code]
const SmallWidth = 494;
var PageNameLabel, PageDescriptionLabel: TLabel;
Procedure NSISImageHeader;
Begin
PageNameLabel:= TLabel.Create(WizardForm);
with PageNameLabel do
begin
SetBounds(WizardForm.PageNameLabel.Left, WizardForm.PageNameLabel.Top, WizardForm.PageNameLabel.Width - 32, WizardForm.PageNameLabel.Height)
AutoSize:= False; WordWrap:= True; Transparent:= True;
Font.Color:= clBlack //clWhite;
Font.Style:= WizardForm.PageNameLabel.Font.Style;
Parent:= WizardForm.MainPanel;
end;
PageDescriptionLabel:= TLabel.Create(WizardForm);
with PageDescriptionLabel do
begin
SetBounds(WizardForm.PageDescriptionLabel.Left, WizardForm.PageDescriptionLabel.Top, WizardForm.PageDescriptionLabel.Width - 32, WizardForm.PageDescriptionLabel.Height)
AutoSize:= False; WordWrap:= True; Transparent:= True;
Font.Color:= clBlack //clWhite;
Parent:= WizardForm.MainPanel;
end;
WizardForm.PageNameLabel.Hide; WizardForm.PageDescriptionLabel.Hide;
WizardForm.WizardSmallBitmapImage.Left:= WizardForm.WizardSmallBitmapImage.Left - (SmallWidth - WizardForm.WizardSmallBitmapImage.Width) + 2
WizardForm.WizardSmallBitmapImage.Width:= SmallWidth
End;
Procedure CurPageChanged(CurPageID: Integer);
Begin
PageNameLabel.Caption:= WizardForm.PageNameLabel.Caption;
PageDescriptionLabel.Caption:= WizardForm.PageDescriptionLabel.Caption;
End;
Procedure InitializeWizard();
Begin
NSISImageHeader;
End;
//CD-KEY
procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
begin
if CurPageID = wpWelcome then
begin
if IsWin64 then
begin
if not RegkeyExists(HKLM, 'SOFTWARE\Wow6432Node\Electronic Arts\EA Games\Mirror''s Edge\ergc') then
begin
Confirm := False;
end;
end;
if not IsWin64 then
begin
if not RegkeyExists(HKLM, 'SOFTWARE\Wow6432Node\Electronic Arts\EA Games\Mirror''s Edge\ergc') then
begin
Confirm := False;
end;
end;
end;
end;
function NextButtonClick(CurPageID: Integer): Boolean;
var
Key: String;
ErrorCode: Integer;
begin
Result := True;
if CurPageID = wpWelcome then
begin
if IsWin64 then
begin
if not RegkeyExists(HKLM, 'SOFTWARE\Wow6432Node\Electronic Arts\EA Games\Mirror''s Edge\ergc') then
begin
WizardForm.Visible := False;
Exec(ExpandConstant('{src}\Support\Mirror''s Edge_code.exe'), '', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ErrorCode);
Result := True;
end;
end;
if not IsWin64 then
begin
if not RegkeyExists(HKLM, 'SOFTWARE\Electronic Arts\EA Games\Mirror''s Edge\ergc') then
begin
WizardForm.Visible := False;
Exec(ExpandConstant('{src}\Support\Mirror''s Edge_code.exe'), '', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ErrorCode);
Result := True;
end;
end;
if IsWin64 then
begin
if RegQueryStringValue(HKLM, 'SOFTWARE\Wow6432Node\Electronic Arts\EA Games\Mirror''s Edge\ergc', '', Key) then
begin
if Key = '' then
begin
RegDeleteKeyIncludingSubkeys(HKLM, 'SOFTWARE\Wow6432Node\Electronic Arts\EA Games\Mirror''s Edge\ergc');
end;
end;
end;
if not IsWin64 then
begin
if RegQueryStringValue(HKLM, 'SOFTWARE\Electronic Arts\EA Games\Mirror''s Edge\ergc', '', Key) then
begin
if Key = '' then
begin
RegDeleteKeyIncludingSubkeys(HKLM, 'SOFTWARE\Electronic Arts\EA Games\Mirror''s Edge\ergc');
end;
end;
end;
WizardForm.Visible := True;
if IsWin64 then
begin
if not RegkeyExists(HKLM, 'SOFTWARE\Wow6432Node\Electronic Arts\EA Games\Mirror''s Edge\ergc') then
begin
Result := False;
WizardForm.Close;
end;
end;
if not IsWin64 then
begin
if not RegkeyExists(HKLM, 'SOFTWARE\Electronic Arts\EA Games\Mirror''s Edge\ergc') then
begin
Result := False;
WizardForm.Close;
end;
end;
end;
end;
//7-zip
var
ProgressBar : TNewProgressBar;
ExtractFile:TNewStaticText;
Button1:TButton;
procedure Extract7z (hWnd, hpb, hst: THandle; fpath, extractPath, pass:pchar); external 'Extract7z@files:is7z.dll stdcall';
procedure CancelExtract; external 'CancelExtract@files:is7z.dll stdcall';
procedure InitializeWizard();
begin
ProgressBar := TNewProgressBar.Create(WizardForm);
ExtractFile:=TNewStaticText.Create(WizardForm);
with WizardForm.ProgressGauge do
begin
ProgressBar.Left := Left;
ProgressBar.Top := Top + ScaleX(55);
ProgressBar.Width := Width;
ProgressBar.Height := Height;
ProgressBar.Parent := WizardForm.InstallingPage;
ProgressBar.max := 100;
ProgressBar.Position := 0;
ExtractFile.parent:=WizardForm.InstallingPage;
ExtractFile.autosize:=false;
ExtractFile.Width := Width;
ExtractFile.top:=Top + ScaleX(35);
ExtractFile.caption:='Распаковка файлов';
end;
end;
procedure Button1OnClick(Sender: TObject);
begin
CancelExtract;
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
If CurStep=ssPostInstall then
begin
Button1:=TButton.create(WizardForm);
Button1.parent:=WizardForm;
Button1.width:=135;
Button1.caption:='Отменить распаковку';
Button1.left:=260;
Button1.top:=WizardForm.cancelbutton.top;
Button1.OnClick:=@Button1OnClick;
try
Extract7z (wizardform.handle, progressbar.handle, ExtractFile.handle, ExpandConstant('{src}') + '\1.7z', ExpandConstant('{app}'), '');
Button1.visible:=false;
except
MsgBox('Неверный пароль!', mbInformation, MB_OK);
Button1.visible:=false;
end;
end;
end;[/more]