Kutsenko,
Raf_SE Цитата: то у меня выдало ошибку и инстал завис
[more=Так]
function ShouldSkipPage(PageID: Integer): Boolean;
begin
if PageID = wpSelectDir then
if RegValueExists(HKLM, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\My Program_is1', 'Inno Setup: App Path') and (CheckRepair.Checked) = True then
Result := True;
if PageID = wpReady then
if RegValueExists(HKLM, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\My Program_is1', 'Inno Setup: App Path') and (CheckRepair.Checked) = True then
Result := True;
end;
[/more]
Добавлено:
Работают все кнопки, на примере выбора компонентов(отмена выбора удаляет компонент)
[more=Собственно пример]
[Setup]
AppName=My Program
AppVerName=My Program
DefaultDirName={pf}\My Program
OutputDir=.
[Languages]
Name: ENG; MessagesFile: compiler:Default.isl;
Name: RUS; MessagesFile: "compiler:Languages\Russian.isl";
[Messages]
RUS.NoUninstallWarning=Текущий выбор компонентов отличается от выбора предыдущей установки программы.%nПродолжить?
[CustomMessages]
ENG.PAGE_CAPTION=Welcome
RUS.PAGE_CAPTION=Добро пожаловать
ENG.PAGE_SUBCAPTION=Modify, repair, or remove the program.
RUS.PAGE_SUBCAPTION=Изменение, исправление или удаление программы.
ENG.PAGE_TEXT_CAPTION=Welcome to the "My Program" Setup Maintenance program.This program lets you modify the current installation.Click one of the options below.
RUS.PAGE_TEXT_CAPTION=Вас приветствует программа установки "My Program".Эта программа позволяет изменять параметры усановки.Нажмите одну из следующих кнопок.
ENG.PAGE_CAPT_1=Modify
RUS.PAGE_CAPT_1=Изменить
ENG.PAGE_SUBCAPT_1=Select new program features to add or select currently installed features to remove.
RUS.PAGE_SUBCAPT_1=Выбор новых компонентов программы для добавления или установленных компонентов - для удаления.
ENG.PAGE_CAPT_2=Repair
RUS.PAGE_CAPT_2=Исправить
ENG.PAGE_SUBCAPT_2=Reinstall all program features installed by the previous setup.
RUS.PAGE_SUBCAPT_2=Переустановка всех компонентов программы, установленных во время предыдущей установки.
ENG.PAGE_CAPT_3=Remove
RUS.PAGE_CAPT_3=Удалить
ENG.PAGE_SUBCAPT_3=Remove all installed features.
RUS.PAGE_SUBCAPT_3=Удаление всех установленных компонентов.
[Components]
Name: "lng"; Description: "Languages Files"; Types: full;
Name: "lng\english"; Description: "English"; Types: full;
Name: "lng\russian"; Description: "Russian"; Types: full;
[Files]
Source: compiler:WizModernSmallImage.bmp; Flags: dontcopy;
Source: Setup.dll; Flags: dontcopy;
Source: compiler:Default.isl; DestDir: {app}; Flags: ignoreversion; Components: lng\english;
Source: "compiler:\Languages\Russian.isl"; DestDir: {app}; Flags: ignoreversion; Components: lng\russian;
[Code]
function GetModuleHandle(lpModuleName: LongInt): LongInt;
external 'GetModuleHandleA@kernel32.dll stdcall';
function ExtractIcon(hInst: LongInt; lpszExeFileName: PChar; nIconIndex: LongInt): LongInt;
external 'ExtractIconA@shell32.dll stdcall';
function DrawIconEx(hdc: LongInt; xLeft, yTop: Integer; hIcon: LongInt; cxWidth, cyWidth: Integer; istepIfAniCur, hbrFlickerFreeDraw, diFlags: LongInt): LongInt;
external 'DrawIconEx@user32.dll stdcall';
var
CheckRe, CheckRepair, CheckRemove: TNewRadioButton;
procedure CurPageChanged(CurPageID: Integer);
var
Panel: TPanel;
BitmapFileName: String;
BitmapImage: TBitmapImage;
Capt, SubCapt, WizCapt, TextRe, TextRepair, TextRemove: TNewStaticText;
Rect: TRect;
HIcon: LongInt;
begin
if CurPageID = wpWelcome then
begin
if RegValueExists(HKLM, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\My Program_is1', 'Inno Setup: App Path') then
begin
ExtractTemporaryFile('Setup.dll');
WizardForm.WizardBitmapImage.Visible := False;
WizardForm.WelcomePage.Color := clBtnFace;
WizardForm.WelcomeLabel1.Visible := False;
WizardForm.WelcomeLabel2.Visible := False;
Panel := TPanel.Create(WizardForm);
Panel.Top := ScaleY(0);
Panel.Left := ScaleX(0);
Panel.Width := WizardForm.Width;
Panel.Height := ScaleY(58);
Panel.Color := clWhite;
Panel.Parent := WizardForm.WelcomePage;
BitmapFileName := ExpandConstant('{tmp}\WizModernSmallImage.bmp');
ExtractTemporaryFile(ExtractFileName(BitmapFileName));
BitmapImage := TBitmapImage.Create(Panel);
BitmapImage.Left := ScaleX(440);
BitmapImage.Top := ScaleY(1);
BitmapImage.AutoSize := True;
BitmapImage.Bitmap.LoadFromFile(BitmapFileName);
BitmapImage.Parent := Panel;
Capt := TNewStaticText.Create(WizardForm);
Capt.Top := ScaleY(10);
Capt.Left := ScaleX(10);
Capt.Width := ScaleX(300);
Capt.Height := ScaleY(14);
Capt.AutoSize := False;
Capt.ShowAccelChar := False;
Capt.Color := clWhite;
Capt.Font.Style := [fsBold];
Capt.Caption := ExpandConstant('{cm:PAGE_CAPTION}');
Capt.Parent := WizardForm.WelcomePage;
SubCapt := TNewStaticText.Create(WizardForm);
SubCapt.Top := ScaleY(25);
SubCapt.Left := ScaleX(15);
SubCapt.Width := ScaleX(350);
SubCapt.Height := ScaleY(30);
SubCapt.AutoSize := False;
SubCapt.ShowAccelChar := False;
SubCapt.Color := clWhite;
SubCapt.Caption := ExpandConstant('{cm:PAGE_SUBCAPTION}');
SubCapt.Parent := WizardForm.WelcomePage;
WizCapt := TNewStaticText.Create(WizardForm);
WizCapt.Top := ScaleY(60);
WizCapt.Left := ScaleX(40);
WizCapt.Width := ScaleX(417);
WizCapt.Height := ScaleY(40);
WizCapt.AutoSize := False;
WizCapt.WordWrap := True;
WizCapt.Caption := ExpandConstant('{cm:PAGE_TEXT_CAPTION}');
WizCapt.Parent := WizardForm.WelcomePage;
CheckRe := TNewRadiobutton.Create(WizardForm);
CheckRe.Left := ScaleX(40);
CheckRe.Top := ScaleY(110)
CheckRe.Width := ScaleX(300);
CheckRe.Font.Style := [fsBold];
CheckRe.Caption := ExpandConstant('{cm:PAGE_CAPT_1}');
CheckRe.Parent := WizardForm.WelcomePage;
hIcon := ExtractIcon(GetModuleHandle(0), ExpandConstant('{tmp}\Setup.dll'), 0);
with TBitmapImage.Create(WizardForm) do
begin
Left := ScaleX(50);
Top := ScaleY(133);
Width := ScaleX(32);
Height := ScaleY(32);
with Bitmap do
begin
Width := ScaleX(32);
Height := ScaleY(32);
Rect.Right := ScaleX(32);
Rect.Bottom := ScaleY(32);
Rect.Left := ScaleX(0);
Rect.Top := ScaleY(0);
Canvas.Brush.Color := clBtnFace;
Canvas.FillRect(Rect);
DrawIconEx(Canvas.Handle, 0, 0, HIcon, 32, 32, 0, 0, 3);
end
Parent := WizardForm.WelcomePage;
end;
TextRe := TNewStaticText.Create(WizardForm);
TextRe.Left := ScaleX(90);
TextRe.Top := ScaleY(133);
TextRe.Width := ScaleX(367);
TextRe.Height := ScaleY(32);
TextRe.AutoSize := False;
TextRe.WordWrap := True;
TextRe.Caption := ExpandConstant('{cm:PAGE_SUBCAPT_1}');
TextRe.Parent := WizardForm.WelcomePage;
CheckRepair := TNewRadiobutton.Create(WizardForm);
CheckRepair.Left := ScaleX(40);
CheckRepair.Top := ScaleY(175);
CheckRepair.Width := ScaleX(300);
CheckRepair.Font.Style := [fsBold];
CheckRepair.Caption := ExpandConstant('{cm:PAGE_CAPT_2}');
CheckRepair.Parent := WizardForm.WelcomePage;
hIcon := ExtractIcon(GetModuleHandle(0), ExpandConstant('{tmp}\Setup.dll'), 1);
with TBitmapImage.Create(WizardForm) do
begin
Left := ScaleX(50);
Top := ScaleY(200);
Width := ScaleX(32);
Height := ScaleY(32);
with Bitmap do
begin
Width := ScaleX(32);
Height := ScaleY(32);
Rect.Right := ScaleX(32);
Rect.Bottom := ScaleY(32);
Rect.Left := ScaleX(0);
Rect.Top := ScaleY(0);
Canvas.Brush.Color := clBtnFace;
Canvas.FillRect(Rect);
DrawIconEx(Canvas.Handle, 0, 0, HIcon, 32, 32, 0, 0, 3);
end
Parent := WizardForm.WelcomePage;
end;
TextRepair := TNewStaticText.Create(WizardForm);
TextRepair.Left := ScaleX(90);
TextRepair.Top := ScaleY(200);
TextRepair.Width := ScaleX(367);
TextRepair.Height := ScaleY(32);
TextRepair.AutoSize := False;
TextRepair.WordWrap := True;
TextRepair.Caption := ExpandConstant('{cm:PAGE_SUBCAPT_2}');
TextRepair.Parent := WizardForm.WelcomePage;
CheckRemove := TNewRadiobutton.Create(WizardForm);
CheckRemove.Left := ScaleX(40);
CheckRemove.Top := ScaleY(242);
CheckRemove.Width := ScaleX(300);
CheckRemove.Font.Style := [fsBold];
CheckRemove.Caption := ExpandConstant('{cm:PAGE_CAPT_3}');
CheckRemove.Checked := True;
CheckRemove.Parent := WizardForm.WelcomePage;
hIcon := ExtractIcon(GetModuleHandle(0), ExpandConstant('{tmp}\Setup.dll'), 2);
with TBitmapImage.Create(WizardForm) do
begin
Left := ScaleX(50);
Top := ScaleY(267);
Width := ScaleX(32);
Height := ScaleY(32);
with Bitmap do
begin
Width := ScaleX(32);
Height := ScaleY(32);
Rect.Right := ScaleX(32);
Rect.Bottom := ScaleY(32);
Rect.Left := ScaleX(0);
Rect.Top := ScaleY(0);
Canvas.Brush.Color := clBtnFace;
Canvas.FillRect(Rect);
DrawIconEx(Canvas.Handle, 0, 0, HIcon, 32, 32, 0, 0, 3);
end
Parent := WizardForm.WelcomePage;
end;
TextRemove := TNewStaticText.Create(WizardForm);
TextRemove.Left := ScaleX(90);
TextRemove.Top := ScaleY(267);
TextRemove.Width := ScaleX(367);
TextRemove.Height := ScaleY(32);
TextRemove.AutoSize := False;
TextRemove.WordWrap := True;
TextRemove.Caption := ExpandConstant('{cm:PAGE_SUBCAPT_3}');
TextRemove.Parent := WizardForm.WelcomePage;
end;
end;
if CurPageID = wpSelectComponents then
WizardForm.ComponentsList.Top := ScaleY(44);
WizardForm.ComponentsList.Height := ScaleY(161);
WizardForm.TypesCombo.Hide;
end;
function ShouldSkipPage(PageID: Integer): Boolean;
begin
if PageID = wpSelectDir then
begin
if RegValueExists(HKLM, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\My Program_is1', 'Inno Setup: App Path') and (CheckRepair.Checked) = True then
Result := True;
if RegValueExists(HKLM, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\My Program_is1', 'Inno Setup: App Path') and (CheckRe.Checked) = True then
Result := True;
end;
if PageID = wpSelectComponents then
if RegValueExists(HKLM, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\My Program_is1', 'Inno Setup: App Path') and (CheckRepair.Checked) = True then
Result := True;
if PageID = wpReady then
if RegValueExists(HKLM, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\My Program_is1', 'Inno Setup: App Path') and (CheckRepair.Checked) = True then
Result := True;
end;
function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
var
S: String;
begin
S := S + MemoDirInfo + NewLine + NewLine;
S := S + MemoComponentsInfo + NewLine;
Result := S;
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssInstall then
if RegValueExists(HKLM, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\My Program_is1', 'Inno Setup: App Path') and (CheckRe.Checked) = True then
begin
if not IsComponentSelected('lng') then
DeleteFile(ExpandConstant('{app}\Default.isl'));
DeleteFile(ExpandConstant('{app}\Russian.isl'));
if IsComponentSelected('lng\english') then
if not IsComponentSelected('lng\russian') then
DeleteFile(ExpandConstant('{app}\Russian.isl'));
if IsComponentSelected('lng\russian') then
if not IsComponentSelected('lng\english') then
DeleteFile(ExpandConstant('{app}\Default.isl'));
end;
end;
function NextButtonClick(CurPageID: Integer): Boolean;
var
Str: String;
ErrorCode: Integer;
begin
Result := True;
if CurPageID = wpWelcome then
begin
if RegValueExists(HKLM, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\My Program_is1', 'Inno Setup: App Path') then
begin
RegQueryStringValue(HKLM, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\My Program_is1', 'UninstallString', Str);
if CheckRemove.Checked = True then
begin
Str := RemoveQuotes(Str);
Exec(Str, '/silent', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
WizardForm.Close;
end;
end;
end;
end;
procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
begin
if CurPageID = wpWelcome then
begin
if RegValueExists(HKLM, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\My Program_is1', 'Inno Setup: App Path') then
begin
if CheckRemove.Checked = True then
Confirm := False;
end;
end;
end;
[/more]