Войти

Показать полную графическую версию : Скрипты Inno Setup. Помощь и советы [часть 6]


Страниц : 1 2 3 4 5 6 7 [8] 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125

Johny777
10-04-2013, 01:29
habib2302,
подскажите.как сделать чтобы перед установкой новой версии экзешник сначало удалял старую версию,а потом начинал установку новой версии »
раз уж пакуешь Аиду то неплохо бы удалить и офф. версии программы а не только свою. На их сайте нашёл 2 версии, и их апп-айди записал в константы
APPID_AIDA_EXTREME
APPID_AIDA_BUISNES
принцип работы кода такой:
1. в функцию GetUninstallPath() отправляем заполненный вручную массив записей апп-айди (в примере ниже 2 вышеупомянутых, включая тот что у твоего инсталла). Она возвращает
массив записей, в каждом элементе которого путь к экзешнику деинсталлятора для каждой программы, если он был найден
2. Если пользователь соглашается на вопрос месседжбокса об удалении найденных программ, то мы отправляем полученный массив путей в процедуру UninstallApps(), которая с ожиданием (спасибо примеру Serega - "ExecAndWait.iss" из шапки ), то бишь по-очереди вызывает деинсталяторы
3. Твой инсталл запустится только если повторный (через рекурсивный вызов ф-ции InitializeSetup() ) вызов функции GetUninstallPath() после пункта 1 и 2 вернёт массив длиной = 0
код:
[Setup]
AppName=MyApp
AppVerName=MyApp
DefaultDirname={pf}\MyApp

AppId=TheBestAidaInstallEver

[ code]
#ifdef UNICODE
#define A "W"
#else
#define A "A"
#endif

const
APPID_AIDA_EXTREME = 'AIDA64 Extreme Edition';
APPID_AIDA_BUISNES = 'AIDA64 Business Edition';

WAIT_OBJECT_0 = $0;
STARTF_USESHOWWINDOW = 1;
NORMAL_PRIORITY_CLASS = $00000020;
INFINITE = $FFFFFFFF; { Infinite timeout }

type
_STARTUPINFO = record
cb: DWORD;
#ifdef UNICODE
lpReserved, lpDesktop, lpTitle: PAnsiChar;
#else
lpReserved, lpDesktop, lpTitle: PChar;
#endif
dwX, dwY, dwXSize, dwYSize, dwXCountChars, dwYCountChars, dwFillAttribute, dwFlags: DWORD;
wShowWindow, cbReserved2: Word;
lpReserved2: Byte;
hStdInput, hStdOutput, hStdError: THandle;
end;

_PROCESS_INFORMATION = record
hProcess: THandle;
hThread: THandle;
dwProcessId: DWORD;
dwThreadId: DWORD;
end;


function CloseHandle(hObject: THandle): BOOL; external 'CloseHandle@kernel32.dll stdcall';
function WaitForSingleObject(hHandle: THandle; dwMilliseconds: DWORD): DWORD; external 'WaitForSingleObject@kernel32.dll stdcall';
#ifdef UNICODE
function CreateProcess(lpApplicationName, lpCommandLine: PAnsiChar; lpProcessAttributes, lpThreadAttributes: Longint; bInheritHandles: BOOL; dwCreationFlags: DWORD; lpEnvironment, lpCurrentDirectory: PAnsiChar; const lpStartupInfo: _STARTUPINFO; var lpProcessInformation: _PROCESS_INFORMATION): BOOL; external 'CreateProcess{#A}@kernel32.dll stdcall';
#else
function CreateProcess(lpApplicationName, lpCommandLine: PChar; lpProcessAttributes, lpThreadAttributes: Longint; bInheritHandles: BOOL; dwCreationFlags: DWORD; lpEnvironment, lpCurrentDirectory: PChar; const lpStartupInfo: _STARTUPINFO; var lpProcessInformation: _PROCESS_INFORMATION): BOOL; external 'CreateProcess{#A}@kernel32.dll stdcall';
#endif


function GetUninstallPath(const AppIds: array of String): array of String;
var
StringList: TStringList;
i, Len: Integer;
Buff: String;
begin
for i := 0 to GetArrayLength(AppIds)-1 do
begin
Buff := RemoveQuotes(ExpandConstant('{reg:HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + AppIds[i] + '_is1,UninstallString|}'));
if Buff <> '' then
begin
Len := GetArrayLength(Result);
SetArrayLength(Result, Len+1);
Result[Len] := Buff;
end;
end;
end;


procedure UninstallApps(const UninstallPathes: array of String);
var
pi: _PROCESS_INFORMATION;
si: _STARTUPINFO;
i: Integer;
begin
for i := 0 to GetArrayLength(UninstallPathes)-1 do
begin
si.cb := SizeOf(si);
si.dwFlags := STARTF_USESHOWWINDOW;
si.wShowWindow := SW_SHOWNORMAL;
#ifdef UNICODE
if not CreateProcess('', PAnsiChar(UninstallPathes[i]), 0, 0, False, NORMAL_PRIORITY_CLASS, '', '', si, pi) then
#else
if not CreateProcess('', PChar(UninstallPathes[i]), 0, 0, False, NORMAL_PRIORITY_CLASS, '', '', si, pi) then
#endif
begin
MsgBox(SysErrorMessage(DLLGetLastError), mbCriticalError, MB_OK);
Exit;
end;
try
while WaitForSingleObject(pi.hProcess, INFINITE) <> WAIT_OBJECT_0 do Application.ProcessMessages;
finally
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
end;
end;
end;


function InitializeSetup(): Boolean;
var
i, Len: Integer;
uArray: array of String;
begin
uArray := GetUninstallPath( ['{#SetupSetting("AppID")}', APPID_AIDA_EXTREME, APPID_AIDA_BUISNES] );
Len := GetArrayLength(uArray);
Result := Len = 0;
if not Result then if MsgBox('Перед установкой необходимо удалить все старые версии приложения, вызвать программы удаления сейчас?', mbError, MB_YESNO) = IDYES then
begin
UninstallApps(uArray);
Result := InitializeSetup();
end;
end;

если тебе нужно предварительное удаление только для твоего инсталла, то вот тебе упрощённый пример:
[Setup]
AppName=MyApp
AppVerName=MyApp
DefaultDirname={pf}\MyApp

AppId=TheBestAidaInstallEver



[ code]
#ifdef UNICODE
#define A "W"
#else
#define A "A"
#endif

const

WAIT_OBJECT_0 = $0;
STARTF_USESHOWWINDOW = 1;
NORMAL_PRIORITY_CLASS = $00000020;
INFINITE = $FFFFFFFF; { Infinite timeout }

type
_STARTUPINFO = record
cb: DWORD;
#ifdef UNICODE
lpReserved, lpDesktop, lpTitle: PAnsiChar;
#else
lpReserved, lpDesktop, lpTitle: PChar;
#endif
dwX, dwY, dwXSize, dwYSize, dwXCountChars, dwYCountChars, dwFillAttribute, dwFlags: DWORD;
wShowWindow, cbReserved2: Word;
lpReserved2: Byte;
hStdInput, hStdOutput, hStdError: THandle;
end;

_PROCESS_INFORMATION = record
hProcess: THandle;
hThread: THandle;
dwProcessId: DWORD;
dwThreadId: DWORD;
end;


function CloseHandle(hObject: THandle): BOOL; external 'CloseHandle@kernel32.dll stdcall';
function WaitForSingleObject(hHandle: THandle; dwMilliseconds: DWORD): DWORD; external 'WaitForSingleObject@kernel32.dll stdcall';
#ifdef UNICODE
function CreateProcess(lpApplicationName, lpCommandLine: PAnsiChar; lpProcessAttributes, lpThreadAttributes: Longint; bInheritHandles: BOOL; dwCreationFlags: DWORD; lpEnvironment, lpCurrentDirectory: PAnsiChar; const lpStartupInfo: _STARTUPINFO; var lpProcessInformation: _PROCESS_INFORMATION): BOOL; external 'CreateProcess{#A}@kernel32.dll stdcall';
#else
function CreateProcess(lpApplicationName, lpCommandLine: PChar; lpProcessAttributes, lpThreadAttributes: Longint; bInheritHandles: BOOL; dwCreationFlags: DWORD; lpEnvironment, lpCurrentDirectory: PChar; const lpStartupInfo: _STARTUPINFO; var lpProcessInformation: _PROCESS_INFORMATION): BOOL; external 'CreateProcess{#A}@kernel32.dll stdcall';
#endif


function UninstallMyApp(): Boolean;
var
pi: _PROCESS_INFORMATION;
si: _STARTUPINFO;
Buff: String;
i: Integer;
begin
if MsgBox('Перед установкой необходимо удалить предыдущую версию приложения. Продолжить?', mbError, MB_YESNO) = IDNO then Exit;
Buff := RemoveQuotes(ExpandConstant('{reg:HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#SetupSe tting("AppID")}_is1,UninstallString|}'));
Result := Buff = '';
if not Result then
begin
si.cb := SizeOf(si);
si.dwFlags := STARTF_USESHOWWINDOW;
si.wShowWindow := SW_SHOWNORMAL;
#ifdef UNICODE
if not CreateProcess('', PAnsiChar(Buff), 0, 0, False, NORMAL_PRIORITY_CLASS, '', '', si, pi) then
#else
if not CreateProcess('', PChar(Buff), 0, 0, False, NORMAL_PRIORITY_CLASS, '', '', si, pi) then
#endif
begin
MsgBox(SysErrorMessage(DLLGetLastError), mbCriticalError, MB_OK);
Exit;
end;
try
while WaitForSingleObject(pi.hProcess, INFINITE) <> WAIT_OBJECT_0 do Application.ProcessMessages;
finally
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
Result := RemoveQuotes(ExpandConstant('{reg:HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#SetupSe tting("AppID")}_is1,UninstallString|}')) = '';
end;
end;
end;


function InitializeSetup(): Boolean;
begin
Result := UninstallMyApp();
end;

habib2302
10-04-2013, 09:42
Johny777, я вставил первый скрипт и при компиляции ошибок нету,но при установке выдает ошибку.вот скрины
http://img836.imageshack.us/img836/7141/thumbume.png (http://img690.imageshack.us/img690/1495/snagit00011004201383730.png) http://img194.imageshack.us/img194/3898/thumbce.png (http://img145.imageshack.us/img145/8716/snagit00021004201383830.png)
может что то я не так сделал?вот скрипт

; Скрипт создан через Мастер Inno Setup Script.
; ИСПОЛЬЗУЙТЕ ДОКУМЕНТАЦИЮ ДЛЯ ПОДРОБНОСТЕЙ ИСПОЛЬЗОВАНИЯ INNO SETUP!

#define MyAppName "AIDA64"
#define MyAppVersion "2.85.2400"
#define MyAppPublisher "Copyright (c) 1995-2013 FinalWire Ltd."
#define MyAppURL "http://www.aida64.com/"
#define AIDA641 "AIDA64 Extreme Edition"
#define AIDA642 "AIDA64 Business Edition"
#define AIDA64EXE1 "aida64.exe"
#define AIDA64EXE2 "aida64.exe"
#define AuthRep "Xabib"
#include "WinTB.iss"
#include "botva2.iss"

[Setup]
; Примечание: Значение AppId идентифицирует это приложение.
; Не используйте одно и тоже значение в разных установках.
; (Для генерации значения GUID, нажмите Инструменты | Генерация GUID.)
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\FinalWire
DefaultGroupName=FinalWire
AllowNoIcons=true
OutputBaseFilename={#MyAppName} {#MyAppVersion}
SetupIconFile=ico.ico
Compression=lzma/Ultra64
SolidCompression=true
InternalCompressLevel=Ultra64
DiskSpanning=false
DiskSliceSize=736000000
ShowLanguageDialog=auto
SlicesPerDisk=4
UninstallDisplayIcon={app}\ico.ico
InfoBeforeFile=info.rtf
;Авторские права.
VersionInfoCopyright={#AuthRep}
;Производитель.
AppPublisher={#AuthRep}
RawDataResource=Botva:botva2.dll|b2p:b2p.dll|Logo:logo.png|bPic:bPic.png|LiPic:LiPic.png|aPic:aPic.p ng
AppCopyright={#AuthRep}
AppVerName={#MyAppVersion}
UninstallDisplayName={#MyAppName}
AppModifyPath={app}
VersionInfoVersion={#MyAppVersion}
VersionInfoTextVersion={#MyAppVersion}
VersionInfoProductName={#MyAppName}
VersionInfoProductVersion={#MyAppVersion}
DirExistsWarning=no
AppendDefaultDirName=no
AppendDefaultGroupName=no
LicenseFile=license.txt
DisableReadyPage=yes
AppId=TheBestAidaInstallEver

[Languages]
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"

[Components]
Name: AIDA641; Description: {#AIDA641}; Flags: exclusive;
Name: AIDA642; Description: {#AIDA642}; Flags: exclusive;

[Tasks]
Name: icons; Description: Создать Ярлыки:;
Name: icons\desktop; Description: На Рабочем Столе;
Name: icons\quicklaunchicon; Description: В Панели Задач; OnlyBelowVersion: 0,6.1;

[Files]
;Файлы распаковываемые в папку с игрой. Необходимы для деинсталлятора;
Source: WinTB.dll; Flags: dontcopy;
Source: info.rtf; DestDir: {app}; Flags: ignoreversion
Source: license.txt; DestDir: {app}; Flags: ignoreversion
Source: ico.ico; DestDir: {app}; Flags: ignoreversion
Source: 1.ico; DestDir: {app}; Flags: ignoreversion
Source: 2.ico; DestDir: {app}; Flags: ignoreversion
Source: {app}\{#AIDA641}\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs; Components: AIDA641;
Source: {app}\{#AIDA642}\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs; Components: AIDA642;
; Примечание: Не используйте "Flags: ignoreversion" для системных файлов

[Icons]
Name: {group}\{#AIDA641}; Filename: {app}\{#AIDA64EXE1}; Components: AIDA641;
Name: {group}\{#AIDA642}; Filename: {app}\{#AIDA64EXE2}; Components: AIDA642;
Name: {group}\{cm:UninstallProgram,{#AIDA641}}; Filename: {uninstallexe}; Components: AIDA641; IconFilename: {app}\1.ico;
Name: {group}\{cm:UninstallProgram,{#AIDA642}}; Filename: {uninstallexe}; Components: AIDA642; IconFilename: {app}\2.ico;
Name: {group}\Сайт {#MyAppName}; Filename: {#MyAppURL}; Components: AIDA641;
Name: {group}\Сайт {#MyAppName}; Filename: {#MyAppURL}; Components: AIDA642;
Name: {group}\Справка {#AIDA641}; Filename: {app}\aida64.chm; Components: AIDA641;
Name: {group}\Справка {#AIDA642}; Filename: {app}\aida64.chm; Components: AIDA642;
Name: {commondesktop}\{#AIDA641}; Filename: {app}\{#AIDA64EXE1}; Tasks: icons\desktop; Components: AIDA641;
Name: {commondesktop}\{#AIDA642}; Filename: {app}\{#AIDA64EXE2}; Tasks: icons\desktop; Components: AIDA642;
Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\{#AIDA641}; Filename: {app}{#AIDA64EXE1}; Tasks: icons\quicklaunchicon; Components: AIDA641;
Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\{#AIDA642}; Filename: {app}{#AIDA64EXE2}; Tasks: icons\quicklaunchicon; Components: AIDA642;

[Run]
Filename: {app}\{#AIDA64EXE1}; Description: "{cm:LaunchProgram,{#StringChange(AIDA641, '&', '&&')}}"; Flags: nowait postinstall skipifsilent Unchecked; Components: AIDA641;
Filename: {app}\{#AIDA64EXE2}; Description: "{cm:LaunchProgram,{#StringChange(AIDA642, '&', '&&')}}"; Flags: nowait postinstall skipifsilent Unchecked; Components: AIDA642;

[Messages]
BeveledLabel=RePack by {#AuthRep}

[.Code]

#ifdef UNICODE
#define A "W"
#else
#define A "A"
#endif
{ RedesignWizardFormBegin } // Не удалять эту строку!
// Не изменять эту секцию. Она создана автоматически.

function OnShouldSkipPage(Sender: TWizardPage): Boolean;
begin
if WizardForm.ComponentsList.Items.Count > 0 then WizardForm.Tag:= 1; // отображаются страницы выбора папки и компонентов
end;

procedure RedesignWizardForm;
begin
with WizardForm.ComponentsList do
begin
Top := ScaleY(50);
Height := ScaleY(155);
end;

{ ReservationBegin }
// Вы можете добавить ваш код здесь.

{ ReservationEnd }
end;
// Не изменять эту секцию. Она создана автоматически.
{ RedesignWizardFormEnd } // Не удалять эту строку!
const
RT_RCDATA = 10;
APPID_AIDA_EXTREME = 'AIDA64 Extreme Edition';
APPID_AIDA_BUISNES = 'AIDA64 Business Edition';

WAIT_OBJECT_0 = $0;
STARTF_USESHOWWINDOW = 1;
NORMAL_PRIORITY_CLASS = $00000020;
INFINITE = $FFFFFFFF; { Infinite timeout }

type
_STARTUPINFO = record
cb: DWORD;
#ifdef UNICODE
lpReserved, lpDesktop, lpTitle: PAnsiChar;
#else
lpReserved, lpDesktop, lpTitle: PChar;
#endif
dwX, dwY, dwXSize, dwYSize, dwXCountChars, dwYCountChars, dwFillAttribute, dwFlags: DWORD;
wShowWindow, cbReserved2: Word;
lpReserved2: Byte;
hStdInput, hStdOutput, hStdError: THandle;
end;

_PROCESS_INFORMATION = record
hProcess: THandle;
hThread: THandle;
dwProcessId: DWORD;
dwThreadId: DWORD;
end;


function CloseHandle(hObject: THandle): BOOL; external 'CloseHandle@kernel32.dll stdcall';
function WaitForSingleObject(hHandle: THandle; dwMilliseconds: DWORD): DWORD; external 'WaitForSingleObject@kernel32.dll stdcall';
#ifdef UNICODE
function CreateProcess(lpApplicationName, lpCommandLine: PAnsiChar; lpProcessAttributes, lpThreadAttributes: Longint; bInheritHandles: BOOL; dwCreationFlags: DWORD; lpEnvironment, lpCurrentDirectory: PAnsiChar; const lpStartupInfo: _STARTUPINFO; var lpProcessInformation: _PROCESS_INFORMATION): BOOL; external 'CreateProcess{#A}@kernel32.dll stdcall';
#else
function CreateProcess(lpApplicationName, lpCommandLine: PChar; lpProcessAttributes, lpThreadAttributes: Longint; bInheritHandles: BOOL; dwCreationFlags: DWORD; lpEnvironment, lpCurrentDirectory: PChar; const lpStartupInfo: _STARTUPINFO; var lpProcessInformation: _PROCESS_INFORMATION): BOOL; external 'CreateProcess{#A}@kernel32.dll stdcall';
#endif


function GetUninstallPath(const AppIds: array of String): array of String;
var
StringList: TStringList;
i, Len: Integer;
Buff: String;
begin
for i := 0 to GetArrayLength(AppIds)-1 do
begin
Buff := RemoveQuotes(ExpandConstant('{reg:HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + AppIds[i] + '_is1,UninstallString|}'));
if Buff <> '' then
begin
Len := GetArrayLength(Result);
SetArrayLength(Result, Len+1);
Result[Len] := Buff;
end;
end;
end;


procedure UninstallApps(const UninstallPathes: array of String);
var
pi: _PROCESS_INFORMATION;
si: _STARTUPINFO;
i: Integer;
begin
for i := 0 to GetArrayLength(UninstallPathes)-1 do
begin
si.cb := SizeOf(si);
si.dwFlags := STARTF_USESHOWWINDOW;
si.wShowWindow := SW_SHOWNORMAL;
#ifdef UNICODE
if not CreateProcess('', PAnsiChar(UninstallPathes[i]), 0, 0, False, NORMAL_PRIORITY_CLASS, '', '', si, pi) then
#else
if not CreateProcess('', PChar(UninstallPathes[i]), 0, 0, False, NORMAL_PRIORITY_CLASS, '', '', si, pi) then
#endif
begin
MsgBox(SysErrorMessage(DLLGetLastError), mbCriticalError, MB_OK);
Exit;
end;
try
while WaitForSingleObject(pi.hProcess, INFINITE) <> WAIT_OBJECT_0 do Application.ProcessMessages;
finally
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
end;
end;
end;

var
TDV: TFolderTreeView;
TFV: TStartMenuFolderTreeView;
ResultCode: Integer;
lPLogo, bPicHandle, bPicHandle2, lPicHandle: THandle;
BtnImage: TBitmapImage;
CheckLicense: TCheckBox;

procedure LicenseOnClick(Sender: TObject);
begin
if (CheckLicense.Checked) = True then
begin
WizardForm.LicenseAcceptedRadio.Checked := True;
end else
begin
WizardForm.LicenseNotAcceptedRadio.Checked := True;
end;
end;

function GetFromRes(const ResName, SaveFileName: String): Boolean;
var
lResStream: TResourceStream;
begin
lResStream := TResourceStream.Create(HInstance, ResName, RT_RCDATA);
try
lResStream.SaveToFile(ExpandConstant('{tmp}\') + SaveFileName);
finally
lResStream.Free;
Result := FileExists(ExpandConstant('{tmp}\') + SaveFileName);
end;
end;

procedure TDVOnChange(Sender: TObject);
begin
if IsComponentSelected('AIDA641') then
WizardForm.DirEdit.Text:= AddBackslash(TDV.Directory)+''
else
if IsComponentSelected('AIDA642') then
WizardForm.DirEdit.Text:= AddBackslash(TDV.Directory)+'';
end;

procedure TFVOnChange(Sender: TObject);
begin
if IsComponentSelected('AIDA641') then
WizardForm.GroupEdit.Text:= AddBackslash(TFV.Directory)+''
else
if IsComponentSelected('AIDA642') then
WizardForm.GroupEdit.Text:= AddBackslash(TFV.Directory)+'';
end;

function InitializeSetup:boolean;
var
i, Len: Integer;
uArray: array of String;
begin
uArray := GetUninstallPath( ['{#SetupSetting("AppID")}', APPID_AIDA_EXTREME, APPID_AIDA_BUISNES] );
Len := GetArrayLength(uArray);
Result := Len = 0;
if not Result then if MsgBox('Перед установкой необходимо удалить все старые версии приложения, вызвать программы удаления сейчас?', mbError, MB_YESNO) = IDYES then
if not FileExists(ExpandConstant('{tmp}\WinTB.dll')) then ExtractTemporaryFile('WinTB.dll');
Result:=True;
begin
UninstallApps(uArray);
Result := InitializeSetup();
end;
end;

procedure InitializeWizard;
begin
RedesignWizardForm;
WizardForm.TypesCombo.hide;
PageFromID(wpSelectDir).OnShouldSkipPage:= @OnShouldSkipPage;
WizardForm.LicenseNotAcceptedRadio.Hide;
WizardForm.LicenseAcceptedRadio.Hide;
WizardForm.LicenseMemo.Height := ScaleY(175);

CheckLicense:= TCheckBox.Create(WizardForm);
CheckLicense.Left:= ScaleX(0);
CheckLicense.Top:= ScaleY(216);
CheckLicense.Caption:= WizardForm.LicenseAcceptedRadio.Caption;
CheckLicense.Width:= ScaleX(417);
CheckLicense.OnClick:= @LicenseOnClick;
CheckLicense.Parent:= WizardForm.LicensePage;
with WizardForm do
begin
if GetFromRes('_IS_BOTVA', 'botva2.dll') and GetFromRes('_IS_B2P', 'b2p.dll') and GetFromRes('_IS_LOGO', 'logo.png') and GetFromRes('_IS_BPIC', 'bPic.png') and GetFromRes('_IS_LIPIC', 'LiPic.png') and GetFromRes('_IS_APIC', 'aPic.png') then
begin
bPicHandle := ImgLoad(WelcomePage.Handle, ExpandConstant('{tmp}\aPic.png'), WizardBitmapImage.Left, WizardBitmapImage.Top, WizardBitmapImage.Width, WizardBitmapImage.Height, True, True);
WizardBitmapImage.Hide;
ImgSetVisibility(bPicHandle, True);
ImgApplyChanges(WelcomePage.Handle);

bPicHandle := ImgLoad(FinishedPage.Handle, ExpandConstant('{tmp}\bPic.png'), WizardBitmapImage2.Left, WizardBitmapImage2.Top, WizardBitmapImage2.Width, WizardBitmapImage2.Height, True, True);
WizardBitmapImage2.Hide;
ImgSetVisibility(bPicHandle, True);
ImgApplyChanges(FinishedPage.Handle);

lPicHandle := ImgLoad(MainPanel.Handle, ExpandConstant('{tmp}\LiPic.png'), WizardSmallBitmapImage.Left, WizardSmallBitmapImage.Top, WizardSmallBitmapImage.Width, WizardSmallBitmapImage.Height, True, True);
WizardSmallBitmapImage.Hide;
ImgSetVisibility(lPicHandle, True);
ImgApplyChanges(MainPanel.Handle);

lPLogo:= ImgLoad(WizardForm.Handle, ExpandConstant('{tmp}\logo.png'), ScaleX(20), ScaleY(320), ScaleX(126), ScaleY(38), True, True);
ImgApplyChanges(WizardForm.Handle);
end;

SetTaskBarProgressValue(0, 60);
SetTaskBarProgressState(0, TBPF_ERROR);
TaskBarV10(MainForm.Handle, WizardForm.Handle, false, false, 0, 0, _m_);

TDV:= TFolderTreeView.Create(WizardForm);
TDV.Top:= WizardForm.DirEdit.Top+28;
TDV.Width:= 417;
TDV.Height:= 100;
TDV.OnChange:= @TDVOnChange;
TDV.Parent:= WizardForm.SelectDirPage;

TFV:= TStartMenuFolderTreeView.Create(nil);
TFV.Top:= WizardForm.GroupEdit.Top+28;
TFV.Width:= 417;
TFV.Height:= 100;
TFV.SetPaths(ExpandConstant('{userprograms}'),ExpandConstant('{commonprograms}'),ExpandConstant('{us erstartup}'),ExpandConstant('{commonstartup}'));
TFV.OnChange:= @TFVOnChange;
TFV.Parent:= WizardForm.SelectProgramGroupPage;

with TLabel.Create(WizardForm) do
begin
Parent:=WizardForm;
AutoSize:=False;
Transparent:= true;
SetBounds(ScaleX(20), ScaleY(320), ScaleX(126), ScaleY(38));
end;
end;
end;

Procedure CurPageChanged(CurPageID: Integer);
Begin
Case CurPageID of
wpSelectDir: if WizardForm.Tag = 1 then
begin
WizardForm.SelectDirPage.Notebook.ActivePage:= WizardForm.SelectComponentsPage;
WizardForm.PageNameLabel.Caption:= SetupMessage(msgWizardSelectComponents);
WizardForm.Hint:= WizardForm.PageDescriptionLabel.Caption; // запомнить SetupMessage(msgSelectDirDesc)
WizardForm.PageDescriptionLabel.Caption:= SetupMessage(msgSelectComponentsDesc);
end;
wpSelectComponents: if WizardForm.Tag = 1 then
begin
WizardForm.SelectComponentsPage.Notebook.ActivePage:= WizardForm.SelectDirPage;
WizardForm.DiskSpaceLabel.Caption:= WizardForm.ComponentsDiskSpaceLabel.Caption;
WizardForm.PageNameLabel.Caption:= SetupMessage(msgWizardSelectDir);
WizardForm.PageDescriptionLabel.Caption:= WizardForm.Hint; // иначе вместо названия программы [name]
if IsComponentSelected('AIDA641') then
begin
WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{#SetupSetting("DefaultDirName")}')) + '{#AIDA641}';
WizardForm.GroupEdit.Text := AddBackslash(ExpandConstant('{#SetupSetting("DefaultGroupName")}')) + '{#AIDA641}';
end else
if IsComponentSelected('AIDA642') then
begin
WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{#SetupSetting("DefaultDirName")}')) + '{#AIDA642}'
WizardForm.GroupEdit.Text := AddBackslash(ExpandConstant('{#SetupSetting("DefaultGroupName")}')) + '{#AIDA642}'
end;
end;
wpSelectTasks:
begin
WizardForm.NextButton.Caption:= SetupMessage(msgButtonInstall);
end;
end;
end;

procedure DeinitializeSetup();
begin
gdipShutdown;
TaskBarDestroy;
end;

procedure InitializeUninstallProgressForm;
begin
with UninstallProgressForm do
begin
if GetFromRes('_IS_BOTVA', 'botva2.dll') and GetFromRes('_IS_B2P', 'b2p.dll') and GetFromRes('_IS_LOGO', 'logo.png') and GetFromRes('_IS_LIPIC', 'LIPic.png') then
begin
lPicHandle := ImgLoad(MainPanel.Handle, ExpandConstant('{tmp}\LiPic.png'), WizardSmallBitmapImage.Left, WizardSmallBitmapImage.Top, WizardSmallBitmapImage.Width, WizardSmallBitmapImage.Height, True, True);
WizardSmallBitmapImage.Hide;
ImgSetVisibility(lPicHandle, True);
ImgApplyChanges(MainPanel.Handle);

lPLogo:= ImgLoad(UninstallProgressForm.Handle, ExpandConstant('{tmp}\logo.png'), ScaleX(20), ScaleY(320), ScaleX(126), ScaleY(38), True, True);
ImgApplyChanges(UninstallProgressForm.Handle);
end;

with TLabel.Create(nil) do
begin
Parent:=UninstallProgressForm;
AutoSize:=False;
Transparent:= true;
SetBounds(ScaleX(20), ScaleY(320), ScaleX(126), ScaleY(38));
end;
end;
end;

procedure DeinitializeUninstall();
begin
gdipShutdown;
end;

или можно сделать так.допустим.у меня установлен компанент AIDA64 Business Edition и я также захотел установить второй компанент т.е AIDA64 Extreme Edition.и можно как нибудь заблокировать RadioButton второго компанента при повторной установке

habib2302
11-04-2013, 10:23
мне кто нибудь ответит на мое сообщение (http://forum.oszone.net/post-2129541-142.html)?

Gnom_aka_Lexander
11-04-2013, 10:37
habib2302, на глазок по экстрасенсорному наитию - ты пытаешься задействовать botva2.dll,но она у тебя не прописана в файлах и отсутствует в инсталле, отсюда рантайм эррор и ошибка обращения к несуществующему объекту.

habib2302
11-04-2013, 10:55
Gnom_aka_Lexander, или можно сделать так.допустим.у меня установлен компанент AIDA64 Business Edition и я также захотел установить второй компанент т.е AIDA64 Extreme Edition.и при повторной установке можно как нибудь заблокировать RadioButton второго компанента?

saurn
11-04-2013, 13:02
habib2302
; Скрипт создан через Мастер Inno Setup Script.
; ИСПОЛЬЗУЙТЕ ДОКУМЕНТАЦИЮ ДЛЯ ПОДРОБНОСТЕЙ ИСПОЛЬЗОВАНИЯ INNO SETUP!

#define MyAppName "AIDA64"
#define MyAppVersion "2.85.2400"
#define MyAppPublisher "Copyright (c) 1995-2013 FinalWire Ltd."
#define MyAppURL "http://www.aida64.com/"
#define AIDA641 "AIDA64 Extreme Edition"
#define AIDA642 "AIDA64 Business Edition"
#define AIDA64EXE1 "aida64.exe"
#define AIDA64EXE2 "aida64.exe"
#define AuthRep "Xabib"
#include "WinTB.iss"
#include "botva2.iss"

[Setup]
; Примечание: Значение AppId идентифицирует это приложение.
; Не используйте одно и тоже значение в разных установках.
; (Для генерации значения GUID, нажмите Инструменты | Генерация GUID.)
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\FinalWire
DefaultGroupName=FinalWire
AllowNoIcons=true
OutputBaseFilename={#MyAppName} {#MyAppVersion}
SetupIconFile=ico.ico
Compression=lzma/Ultra64
SolidCompression=true
InternalCompressLevel=Ultra64
DiskSpanning=false
DiskSliceSize=736000000
ShowLanguageDialog=auto
SlicesPerDisk=4
UninstallDisplayIcon={app}\ico.ico
InfoBeforeFile=info.rtf
;Авторские права.
VersionInfoCopyright={#AuthRep}
;Производитель.
AppPublisher={#AuthRep}
RawDataResource=Botva:botva2.dll|b2p:b2p.dll|Logo:logo.png|bPic:bPic.png|LiPic:LiPic.png|aPic:aPic.p ng
AppCopyright={#AuthRep}
AppVerName={#MyAppVersion}
UninstallDisplayName={#MyAppName}
AppModifyPath={app}
VersionInfoVersion={#MyAppVersion}
VersionInfoTextVersion={#MyAppVersion}
VersionInfoProductName={#MyAppName}
VersionInfoProductVersion={#MyAppVersion}
DirExistsWarning=no
AppendDefaultDirName=no
AppendDefaultGroupName=no
LicenseFile=license.txt
DisableReadyPage=yes
AppId=TheBestAidaInstallEver

[Languages]
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"

[Components]
Name: AIDA641; Description: {#AIDA641}; Flags: exclusive;
Name: AIDA642; Description: {#AIDA642}; Flags: exclusive;

[Tasks]
Name: icons; Description: Создать Ярлыки:;
Name: icons\desktop; Description: На Рабочем Столе;
Name: icons\quicklaunchicon; Description: В Панели Задач; OnlyBelowVersion: 0,6.1;

[Files]
;Файлы распаковываемые в папку с игрой. Необходимы для деинсталлятора;
Source: WinTB.dll; Flags: dontcopy;
Source: info.rtf; DestDir: {app}; Flags: ignoreversion
Source: license.txt; DestDir: {app}; Flags: ignoreversion
Source: ico.ico; DestDir: {app}; Flags: ignoreversion
Source: 1.ico; DestDir: {app}; Flags: ignoreversion
Source: 2.ico; DestDir: {app}; Flags: ignoreversion
Source: {app}\{#AIDA641}\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs; Components: AIDA641;
Source: {app}\{#AIDA642}\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs; Components: AIDA642;
; Примечание: Не используйте "Flags: ignoreversion" для системных файлов

[Icons]
Name: {group}\{#AIDA641}; Filename: {app}\{#AIDA64EXE1}; Components: AIDA641;
Name: {group}\{#AIDA642}; Filename: {app}\{#AIDA64EXE2}; Components: AIDA642;
Name: {group}\{cm:UninstallProgram,{#AIDA641}}; Filename: {uninstallexe}; Components: AIDA641; IconFilename: {app}\1.ico;
Name: {group}\{cm:UninstallProgram,{#AIDA642}}; Filename: {uninstallexe}; Components: AIDA642; IconFilename: {app}\2.ico;
Name: {group}\Сайт {#MyAppName}; Filename: {#MyAppURL}; Components: AIDA641;
Name: {group}\Сайт {#MyAppName}; Filename: {#MyAppURL}; Components: AIDA642;
Name: {group}\Справка {#AIDA641}; Filename: {app}\aida64.chm; Components: AIDA641;
Name: {group}\Справка {#AIDA642}; Filename: {app}\aida64.chm; Components: AIDA642;
Name: {commondesktop}\{#AIDA641}; Filename: {app}\{#AIDA64EXE1}; Tasks: icons\desktop; Components: AIDA641;
Name: {commondesktop}\{#AIDA642}; Filename: {app}\{#AIDA64EXE2}; Tasks: icons\desktop; Components: AIDA642;
Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\{#AIDA641}; Filename: {app}{#AIDA64EXE1}; Tasks: icons\quicklaunchicon; Components: AIDA641;
Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\{#AIDA642}; Filename: {app}{#AIDA64EXE2}; Tasks: icons\quicklaunchicon; Components: AIDA642;

[Run]
Filename: {app}\{#AIDA64EXE1}; Description: "{cm:LaunchProgram,{#StringChange(AIDA641, '&', '&&')}}"; Flags: nowait postinstall skipifsilent Unchecked; Components: AIDA641;
Filename: {app}\{#AIDA64EXE2}; Description: "{cm:LaunchProgram,{#StringChange(AIDA642, '&', '&&')}}"; Flags: nowait postinstall skipifsilent Unchecked; Components: AIDA642;

[Messages]
BeveledLabel=RePack by {#AuthRep}

[Code]
#ifdef UNICODE
#define A "W"
#else
#define A "A"
#endif

const
RT_RCDATA = 10;
APPID_AIDA_EXTREME = 'AIDA64 Extreme Edition';
APPID_AIDA_BUISNES = 'AIDA64 Business Edition';

WAIT_OBJECT_0 = $0;
STARTF_USESHOWWINDOW = 1;
NORMAL_PRIORITY_CLASS = $00000020;
INFINITE = $FFFFFFFF;

type
_STARTUPINFO = record
cb: DWORD;
#ifdef UNICODE
lpReserved, lpDesktop, lpTitle: PAnsiChar;
#else
lpReserved, lpDesktop, lpTitle: PChar;
#endif
dwX, dwY, dwXSize, dwYSize, dwXCountChars, dwYCountChars, dwFillAttribute, dwFlags: DWORD;
wShowWindow, cbReserved2: Word;
lpReserved2: Byte;
hStdInput, hStdOutput, hStdError: THandle;
end;

_PROCESS_INFORMATION = record
hProcess: THandle;
hThread: THandle;
dwProcessId: DWORD;
dwThreadId: DWORD;
end;


function CloseHandle(hObject: THandle): BOOL; external 'CloseHandle@kernel32.dll stdcall';
function WaitForSingleObject(hHandle: THandle; dwMilliseconds: DWORD): DWORD; external 'WaitForSingleObject@kernel32.dll stdcall';
#ifdef UNICODE
function CreateProcess(lpApplicationName, lpCommandLine: PAnsiChar; lpProcessAttributes, lpThreadAttributes: Longint; bInheritHandles: BOOL; dwCreationFlags: DWORD; lpEnvironment, lpCurrentDirectory: PAnsiChar; const lpStartupInfo: _STARTUPINFO; var lpProcessInformation: _PROCESS_INFORMATION): BOOL; external 'CreateProcess{#A}@kernel32.dll stdcall';
#else
function CreateProcess(lpApplicationName, lpCommandLine: PChar; lpProcessAttributes, lpThreadAttributes: Longint; bInheritHandles: BOOL; dwCreationFlags: DWORD; lpEnvironment, lpCurrentDirectory: PChar; const lpStartupInfo: _STARTUPINFO; var lpProcessInformation: _PROCESS_INFORMATION): BOOL; external 'CreateProcess{#A}@kernel32.dll stdcall';
#endif

var
TDV: TFolderTreeView;
TFV: TStartMenuFolderTreeView;
ResultCode: Integer;
lPLogo, bPicHandle, bPicHandle2, lPicHandle: THandle;
BtnImage: TBitmapImage;
CheckLicense: TCheckBox;
iInitialize: Boolean;


function GetUninstallPath(const AppIds: array of String): array of String;
var
StringList: TStringList;
i, Len: Integer;
Buff: String;
begin
for i := 0 to GetArrayLength(AppIds)-1 do
begin
Buff := RemoveQuotes(ExpandConstant('{reg:HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + AppIds[i] + '_is1,UninstallString|}'));
if Buff <> '' then
begin
Len := GetArrayLength(Result);
SetArrayLength(Result, Len+1);
Result[Len] := Buff;
end;
end;
end;


procedure UninstallApps(const UninstallPathes: array of String);
var
pi: _PROCESS_INFORMATION;
si: _STARTUPINFO;
i: Integer;
begin
for i := 0 to GetArrayLength(UninstallPathes)-1 do
begin
si.cb := SizeOf(si);
si.dwFlags := STARTF_USESHOWWINDOW;
si.wShowWindow := SW_SHOWNORMAL;
#ifdef UNICODE
if not CreateProcess('', PAnsiChar(UninstallPathes[i]), 0, 0, False, NORMAL_PRIORITY_CLASS, '', '', si, pi) then
#else
if not CreateProcess('', PChar(UninstallPathes[i]), 0, 0, False, NORMAL_PRIORITY_CLASS, '', '', si, pi) then
#endif
begin
MsgBox(SysErrorMessage(DLLGetLastError), mbCriticalError, MB_OK);
Exit;
end;
try
while WaitForSingleObject(pi.hProcess, INFINITE) <> WAIT_OBJECT_0 do Application.ProcessMessages;
finally
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
end;
end;
end;

function GetFromRes(const ResName, SaveFileName: String): Boolean;
var
lResStream: TResourceStream;
begin
lResStream := TResourceStream.Create(HInstance, ResName, RT_RCDATA);
try
lResStream.SaveToFile(AddBackslash(ExpandConstant('{tmp}')) + SaveFileName);
finally
lResStream.Free;
Result := FileExists(AddBackslash(ExpandConstant('{tmp}')) + SaveFileName);
end;
end;

function InitializeSetup:boolean;
var
i, Len: Integer;
uArray: array of String;
begin
uArray := GetUninstallPath( ['{#SetupSetting("AppID")}', APPID_AIDA_EXTREME, APPID_AIDA_BUISNES] );
Len := GetArrayLength(uArray);
Result := Len = 0;
if not Result then if MsgBox('Перед установкой необходимо удалить все старые версии приложения, вызвать программы удаления сейчас?', mbError, MB_YESNO) = IDYES then
begin
UninstallApps(uArray);
Result := InitializeSetup();
end;
end;

procedure LicenseOnClick(Sender: TObject);
begin
case TCheckBox(Sender).Checked of
True: WizardForm.LicenseAcceptedRadio.Checked := True;
False: WizardForm.LicenseNotAcceptedRadio.Checked := True;
end;
end;

procedure TDVOnChange(Sender: TObject);
begin
if IsComponentSelected('AIDA641') then
WizardForm.DirEdit.Text:= AddBackslash(TDV.Directory)+''
else
if IsComponentSelected('AIDA642') then
WizardForm.DirEdit.Text:= AddBackslash(TDV.Directory)+'';
end;

procedure TFVOnChange(Sender: TObject);
begin
if IsComponentSelected('AIDA641') then
WizardForm.GroupEdit.Text:= AddBackslash(TFV.Directory)+''
else
if IsComponentSelected('AIDA642') then
WizardForm.GroupEdit.Text:= AddBackslash(TFV.Directory)+'';
end;

function OnShouldSkipPage(Sender: TWizardPage): Boolean;
begin
if WizardForm.ComponentsList.Items.Count > 0 then WizardForm.Tag:= 1; // отображаются страницы выбора папки и компонентов
end;

procedure RedesignWizardForm;
begin
with WizardForm.ComponentsList do
begin
Top := ScaleY(50);
Height := ScaleY(155);
end;
end;

procedure InitializeWizard;
begin
RedesignWizardForm;
WizardForm.TypesCombo.hide;
PageFromID(wpSelectDir).OnShouldSkipPage:= @OnShouldSkipPage;
WizardForm.LicenseNotAcceptedRadio.Hide;
WizardForm.LicenseAcceptedRadio.Hide;
WizardForm.LicenseMemo.Height := ScaleY(175);

CheckLicense:= TCheckBox.Create(WizardForm);
CheckLicense.Left:= ScaleX(0);
CheckLicense.Top:= ScaleY(216);
CheckLicense.Caption:= WizardForm.LicenseAcceptedRadio.Caption;
CheckLicense.Width:= ScaleX(417);
CheckLicense.OnClick:= @LicenseOnClick;
CheckLicense.Parent:= WizardForm.LicensePage;
with WizardForm do
begin
iInitialize := True;
if GetFromRes('_IS_BOTVA', 'botva2.dll') and GetFromRes('_IS_B2P', 'b2p.dll') and GetFromRes('_IS_LOGO', 'logo.png') and GetFromRes('_IS_BPIC', 'bPic.png') and GetFromRes('_IS_LIPIC', 'LiPic.png') and GetFromRes('_IS_APIC', 'aPic.png') then
begin
bPicHandle := ImgLoad(WelcomePage.Handle, ExpandConstant('{tmp}\aPic.png'), WizardBitmapImage.Left, WizardBitmapImage.Top, WizardBitmapImage.Width, WizardBitmapImage.Height, True, True);
WizardBitmapImage.Hide;
ImgSetVisibility(bPicHandle, True);
ImgApplyChanges(WelcomePage.Handle);

bPicHandle := ImgLoad(FinishedPage.Handle, ExpandConstant('{tmp}\bPic.png'), WizardBitmapImage2.Left, WizardBitmapImage2.Top, WizardBitmapImage2.Width, WizardBitmapImage2.Height, True, True);
WizardBitmapImage2.Hide;
ImgSetVisibility(bPicHandle, True);
ImgApplyChanges(FinishedPage.Handle);

lPicHandle := ImgLoad(MainPanel.Handle, ExpandConstant('{tmp}\LiPic.png'), WizardSmallBitmapImage.Left, WizardSmallBitmapImage.Top, WizardSmallBitmapImage.Width, WizardSmallBitmapImage.Height, True, True);
WizardSmallBitmapImage.Hide;
ImgSetVisibility(lPicHandle, True);
ImgApplyChanges(MainPanel.Handle);

lPLogo:= ImgLoad(WizardForm.Handle, ExpandConstant('{tmp}\logo.png'), ScaleX(20), ScaleY(320), ScaleX(126), ScaleY(38), True, True);
ImgApplyChanges(WizardForm.Handle);
end;

ExtractTemporaryFile('WinTB.dll');
SetTaskBarProgressValue(0, 60);
SetTaskBarProgressState(0, TBPF_ERROR);
TaskBarV10(MainForm.Handle, WizardForm.Handle, false, false, 0, 0, _m_);

TDV:= TFolderTreeView.Create(WizardForm);
TDV.Top:= WizardForm.DirEdit.Top+28;
TDV.Width:= 417;
TDV.Height:= 100;
TDV.OnChange:= @TDVOnChange;
TDV.Parent:= WizardForm.SelectDirPage;

TFV:= TStartMenuFolderTreeView.Create(nil);
TFV.Top:= WizardForm.GroupEdit.Top+28;
TFV.Width:= 417;
TFV.Height:= 100;
TFV.SetPaths(ExpandConstant('{userprograms}'),ExpandConstant('{commonprograms}'),ExpandConstant('{us erstartup}'),ExpandConstant('{commonstartup}'));
TFV.OnChange:= @TFVOnChange;
TFV.Parent:= WizardForm.SelectProgramGroupPage;

with TLabel.Create(WizardForm) do
begin
Parent:=WizardForm;
AutoSize:=False;
Transparent:= true;
SetBounds(ScaleX(20), ScaleY(320), ScaleX(126), ScaleY(38));
end;
end;
end;

Procedure CurPageChanged(CurPageID: Integer);
Begin
Case CurPageID of
wpSelectDir: if WizardForm.Tag = 1 then
begin
WizardForm.SelectDirPage.Notebook.ActivePage:= WizardForm.SelectComponentsPage;
WizardForm.PageNameLabel.Caption:= SetupMessage(msgWizardSelectComponents);
WizardForm.Hint:= WizardForm.PageDescriptionLabel.Caption; // запомнить SetupMessage(msgSelectDirDesc)
WizardForm.PageDescriptionLabel.Caption:= SetupMessage(msgSelectComponentsDesc);
end;
wpSelectComponents: if WizardForm.Tag = 1 then
begin
WizardForm.SelectComponentsPage.Notebook.ActivePage:= WizardForm.SelectDirPage;
WizardForm.DiskSpaceLabel.Caption:= WizardForm.ComponentsDiskSpaceLabel.Caption;
WizardForm.PageNameLabel.Caption:= SetupMessage(msgWizardSelectDir);
WizardForm.PageDescriptionLabel.Caption:= WizardForm.Hint; // иначе вместо названия программы [name]
if IsComponentSelected('AIDA641') then
begin
WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{#SetupSetting("DefaultDirName")}')) + '{#AIDA641}';
WizardForm.GroupEdit.Text := AddBackslash(ExpandConstant('{#SetupSetting("DefaultGroupName")}')) + '{#AIDA641}';
end else
if IsComponentSelected('AIDA642') then
begin
WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{#SetupSetting("DefaultDirName")}')) + '{#AIDA642}'
WizardForm.GroupEdit.Text := AddBackslash(ExpandConstant('{#SetupSetting("DefaultGroupName")}')) + '{#AIDA642}'
end;
end;
wpSelectTasks:
begin
WizardForm.NextButton.Caption:= SetupMessage(msgButtonInstall);
end;
end;
end;

procedure DeinitializeSetup();
begin
if iInitialize then
begin
gdipShutdown;
TaskBarDestroy;
end;
end;

procedure InitializeUninstallProgressForm;
begin
with UninstallProgressForm do
begin
if GetFromRes('_IS_BOTVA', 'botva2.dll') and GetFromRes('_IS_B2P', 'b2p.dll') and GetFromRes('_IS_LOGO', 'logo.png') and GetFromRes('_IS_LIPIC', 'LIPic.png') then
begin
lPicHandle := ImgLoad(MainPanel.Handle, ExpandConstant('{tmp}\LiPic.png'), WizardSmallBitmapImage.Left, WizardSmallBitmapImage.Top, WizardSmallBitmapImage.Width, WizardSmallBitmapImage.Height, True, True);
WizardSmallBitmapImage.Hide;
ImgSetVisibility(lPicHandle, True);
ImgApplyChanges(MainPanel.Handle);

lPLogo:= ImgLoad(UninstallProgressForm.Handle, ExpandConstant('{tmp}\logo.png'), ScaleX(20), ScaleY(320), ScaleX(126), ScaleY(38), True, True);
ImgApplyChanges(UninstallProgressForm.Handle);
end;

with TLabel.Create(nil) do
begin
Parent:=UninstallProgressForm;
AutoSize:=False;
Transparent:= true;
SetBounds(ScaleX(20), ScaleY(320), ScaleX(126), ScaleY(38));
end;
end;
end;

procedure DeinitializeUninstall();
begin
gdipShutdown;
end;


и при повторной установке можно как нибудь заблокировать RadioButton второго компанента? »
Inno записывает в реестр данные о том, какие компоненты были отмечены в ходе установки. Используйте эти данные, чтобы включать\отключать компоненты.

P.S.
Вы когда скрипты объединяете, смотрите, что, куда и как вы вставляете.
А вот ваша ошибка:
if not Result then if MsgBox('Перед установкой необходимо удалить все старые версии приложения, вызвать программы удаления сейчас?', mbError, MB_YESNO) = IDYES then
if not FileExists(ExpandConstant('{tmp}\WinTB.dll')) then ExtractTemporaryFile('WinTB.dll');
Result:=True;

habib2302
11-04-2013, 15:38
saurn, огромное тебе спасибо!!!!!выручил ты меня!!!!!

neorom
11-04-2013, 20:19
Я так вижу, все меня игнарироют !!! Ладно.

insombia
11-04-2013, 21:01
neorom тебя не игнорят,прост твой вопрос бред,как могут идти проценты без прогресс бара?как ты себе это представляешь?

Mailchik
11-04-2013, 21:32
как могут идти проценты без прогресс бара?как ты себе это представляешь? »молча.
Я так вижу, все меня игнарироют !!! Ладно. »люди хотят, чтобы вы хоть что то сделали сами. чем больше вам помогают, тем больше вы спрашиваете.
#define NeedSize "5000000000"

#define NeedMem 512

;#define SecondProgressBar

;#define Components

;#define records

;#define facompress

;#define PrecompInside
;#define SrepInside
;#define MSCInside
;#define precomp "0.42"
;#define unrar
;#define XDelta
;#define PackZIP

[Setup]
AppName=ISDone
AppVerName=ISDone
DefaultDirName={pf}\ISDone
DefaultGroupName=ISDone Example
OutputDir=.
OutputBaseFilename=Setup
VersionInfoCopyright=ProFrager
SolidCompression=yes
#ifdef NeedSize
ExtraDiskSpaceRequired={#NeedSize}
#endif

#ifdef Components
[Types]
Name: full; Description: Full installation; Flags: iscustom

[Components]
Name: text; Description: Язык субтитров; Types: full; Flags: fixed
Name: text\rus; Description: Русский; Flags: exclusive; ExtraDiskSpaceRequired: 100000000
Name: text\eng; Description: Английский; Flags: exclusive; ExtraDiskSpaceRequired: 200000000
Name: voice; Description: Язык озвучки; Types: full; Flags: fixed
Name: voice\rus; Description: Русский; Flags: exclusive; ExtraDiskSpaceRequired: 500000000
Name: voice\eng; Description: Английский; Flags: exclusive; ExtraDiskSpaceRequired: 600000000
#endif

[Registry]
Root: HKLM; Subkey: Software\ProFrager; ValueName: path; ValueType: String; ValueData: {app}; Flags: uninsdeletekey; Check: CheckError
Root: HKLM; Subkey: Software\ProFrager; ValueName: name; ValueType: String; ValueData: Data; Flags: uninsdeletekey; Check: CheckError

[Icons]
Name: {group}\Удалить пример ISDone; Filename: {app}\unins000.exe; WorkingDir: {app}; Check: CheckError
Name: {commondesktop}\Удалить пример ISDone; Filename: {app}\unins000.exe; WorkingDir: {app}; Check: CheckError

[Tasks]
Name: VCCheck; Description: Установить Microsoft Visual C++ 2005 Redist
Name: PhysXCheck; Description: Установить Nvidia PhysX

[Run]
Filename: {src}\Redist\vcredist_x86.exe; Parameters: /q; StatusMsg: Устанавливаем Microsoft Visual C++ 2005 Redist...; Flags: skipifdoesntexist; Tasks: VCCheck; Check: CheckError
Filename: {src}\Redist\PhysX.exe; Parameters: /qn; StatusMsg: Устанавливаем Nvidia PhysX...; Flags: skipifdoesntexist; Tasks: PhysXCheck; Check: CheckError

[Files]
Source: Include\English.ini; DestDir: {tmp}; Flags: dontcopy
Source: Include\unarc.dll; DestDir: {tmp}; Flags: dontcopy
Source: ISDone.dll; DestDir: {tmp}; Flags: dontcopy
#ifdef records
Source: records.inf; DestDir: {tmp}; Flags: dontcopy
#endif

#ifdef PrecompInside
Source: Include\CLS-precomp.dll; DestDir: {tmp}; Flags: dontcopy
Source: Include\packjpg_dll.dll; DestDir: {tmp}; Flags: dontcopy
Source: Include\packjpg_dll1.dll; DestDir: {tmp}; Flags: dontcopy
Source: Include\precomp.exe; DestDir: {tmp}; Flags: dontcopy
Source: Include\zlib1.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef SrepInside
Source: Include\CLS-srep.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef MSCInside
Source: Include\CLS-MSC.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef facompress
Source: Include\facompress.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef precomp
#if precomp == "0.38"
Source: Include\precomp038.exe; DestDir: {tmp}; Flags: dontcopy
#else
#if precomp == "0.4"
Source: Include\precomp040.exe; DestDir: {tmp}; Flags: dontcopy
#else
#if precomp == "0.41"
Source: Include\precomp041.exe; DestDir: {tmp}; Flags: dontcopy
#else
#if precomp == "0.42"
Source: Include\precomp042.exe; DestDir: {tmp}; Flags: dontcopy
#else
Source: Include\precomp038.exe; DestDir: {tmp}; Flags: dontcopy
Source: Include\precomp040.exe; DestDir: {tmp}; Flags: dontcopy
Source: Include\precomp041.exe; DestDir: {tmp}; Flags: dontcopy
Source: Include\precomp042.exe; DestDir: {tmp}; Flags: dontcopy
#endif
#endif
#endif
#endif
#endif
#ifdef unrar
Source: Include\Unrar.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef XDelta
Source: Include\XDelta3.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef PackZIP
Source: Include\7z.dll; DestDir: {tmp}; Flags: dontcopy
Source: Include\packZIP.exe; DestDir: {tmp}; Flags: dontcopy
#endif

[CustomMessages]
russian.ExtractedFile=Извлекается файл:
russian.Extracted=Распаковка архивов...
russian.CancelButton=Отменить распаковку
russian.Error=Ошибка распаковки!
russian.ElapsedTime=Прошло:
russian.RemainingTime=Осталось времени:
russian.EstimatedTime=Всего:
russian.AllElapsedTime=Время установки:

[Languages]
Name: russian; MessagesFile: compiler:Languages\Russian.isl

[UninstallDelete]
Type: filesandordirs; Name: {app}

[code]
const
PCFonFLY=true;
notPCFonFLY=false;
var
LabelPct1,LabelCurrFileName,LabelTime1,LabelTime2,LabelTime3: TLabel;
#ifdef SecondProgressBar
LabelPct2: TLabel;
#endif
MyCancelButton: TButton;
ISDoneCancel:integer;
ISDoneError:boolean;
PCFVer:double;

type
TCallback = function (OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAnsiChar): longword;

function WrapCallback(callback:TCallback; paramcount:integer):longword;external 'wrapcallback@files:ISDone.dll stdcall delayload';

function ISArcExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutPath, ExtractedPath: AnsiString; DeleteInFile:boolean; Password, CfgFile, WorkPath: AnsiString; ExtractPCF: boolean ):boolean; external 'ISArcExtract@files:ISDone.dll stdcall delayload';
function IS7ZipExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutPath: AnsiString; DeleteInFile:boolean; Password: AnsiString):boolean; external 'IS7zipExtract@files:ISDone.dll stdcall delayload';
function ISRarExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutPath: AnsiString; DeleteInFile:boolean; Password: AnsiString):boolean; external 'ISRarExtract@files:ISDone.dll stdcall delayload';
function ISPrecompExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutFile: AnsiString; DeleteInFile:boolean):boolean; external 'ISPrecompExtract@files:ISDone.dll stdcall delayload';
function ISSRepExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutFile: AnsiString; DeleteInFile:boolean):boolean; external 'ISSrepExtract@files:ISDone.dll stdcall delayload';
function ISxDeltaExtract(CurComponent:Cardinal; PctOfTotal:double; minRAM,maxRAM:integer; InName, DiffFile, OutFile: AnsiString; DeleteInFile, DeleteDiffFile:boolean):boolean; external 'ISxDeltaExtract@files:ISDone.dll stdcall delayload';
function ISPackZIP(CurComponent:Cardinal; PctOfTotal:double; InName, OutFile: AnsiString;ComprLvl:integer; DeleteInFile:boolean):boolean; external 'ISPackZIP@files:ISDone.dll stdcall delayload';
function ShowChangeDiskWindow(Text, DefaultPath, SearchFile:AnsiString):boolean; external 'ShowChangeDiskWindow@files:ISDone.dll stdcall delayload';

function Exec2 (FileName, Param: PAnsiChar;Show:boolean):boolean; external 'Exec2@files:ISDone.dll stdcall delayload';
function ISFindFiles(CurComponent:Cardinal; FileMask:AnsiString; var ColFiles:integer):integer; external 'ISFindFiles@files:ISDone.dll stdcall delayload';
function ISPickFilename(FindHandle:integer; OutPath:AnsiString; var CurIndex:integer; DeleteInFile:boolean):boolean; external 'ISPickFilename@files:ISDone.dll stdcall delayload';
function ISGetName(TypeStr:integer):PAnsichar; external 'ISGetName@files:ISDone.dll stdcall delayload';
function ISFindFree(FindHandle:integer):boolean; external 'ISFindFree@files:ISDone.dll stdcall delayload';
function ISExec(CurComponent:Cardinal; PctOfTotal,SpecifiedProcessTime:double; ExeName,Parameters,TargetDir,OutputStr:AnsiString;Show:boolean):boolean; external 'ISExec@files:ISDone.dll stdcall delayload';

function SrepInit(TmpPath:PAnsiChar;VirtMem,MaxSave:Cardinal):boolean; external 'SrepInit@files:ISDone.dll stdcall delayload';
function PrecompInit(TmpPath:PAnsiChar;VirtMem:cardinal;PrecompVers:single):boolean; external 'PrecompInit@files:ISDone.dll stdcall delayload';
function FileSearchInit(RecursiveSubDir:boolean):boolean; external 'FileSearchInit@files:ISDone.dll stdcall delayload';
function ISDoneInit(RecordFileName:AnsiString; TimeType,Comp1,Comp2,Comp3:Cardinal; WinHandle, NeededMem:longint; callback:TCallback):boolean; external 'ISDoneInit@files:ISDone.dll stdcall';
function ISDoneStop:boolean; external 'ISDoneStop@files:ISDone.dll stdcall';
function ChangeLanguage(Language:AnsiString):boolean; external 'ChangeLanguage@files:ISDone.dll stdcall delayload';
function SuspendProc:boolean; external 'SuspendProc@files:ISDone.dll stdcall';
function ResumeProc:boolean; external 'ResumeProc@files:ISDone.dll stdcall';

function ProgressCallback(OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAnsiChar): longword;
begin
LabelPct1.Caption := IntToStr(OveralPct div 10)+'.'+chr(48 + OveralPct mod 10)+'%';
#ifdef SecondProgressBar
LabelPct2.Caption := IntToStr(CurrentPct div 10)+'.'+chr(48 + CurrentPct mod 10)+'%';
#endif
LabelCurrFileName.Caption:=ExpandConstant('{cm:ExtractedFile} ')+MinimizePathName(CurrentFile, LabelCurrFileName.Font, LabelCurrFileName.Width-ScaleX(100));
LabelTime1.Caption:=ExpandConstant('{cm:ElapsedTime} ')+TimeStr2;
LabelTime2.Caption:=ExpandConstant('{cm:RemainingTime} ')+TimeStr1;
LabelTime3.Caption:=ExpandConstant('{cm:AllElapsedTime}')+TimeStr3;
Result := ISDoneCancel;
end;

procedure CancelButtonOnClick(Sender: TObject);
begin
SuspendProc;
if MsgBox(SetupMessage(msgExitSetupMessage), mbConfirmation, MB_YESNO) = IDYES then ISDoneCancel:=1;
ResumeProc;
end;

procedure HideControls;
begin
WizardForm.FileNamelabel.Hide;
LabelPct1.Hide;
LabelCurrFileName.Hide;
LabelTime1.Hide;
LabelTime2.Hide;
MyCancelButton.Hide;
#ifdef SecondProgressBar
LabelPct2.Hide;
#endif
end;

procedure CreateControls;
var PBTop:integer;
begin
PBTop:=ScaleY(50);
LabelPct1 := TLabel.Create(WizardForm);
with LabelPct1 do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Left := ScaleX(370);
Top := PBTop + ScaleY(2);
Width := ScaleX(80);
end;
LabelCurrFileName := TLabel.Create(WizardForm);
with LabelCurrFileName do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Width := ScaleX(395);
Left := ScaleX(0);
Top := ScaleY(30);
end;
#ifdef SecondProgressBar
PBTop:=PBTop+ScaleY(25);
LabelPct2 := TLabel.Create(WizardForm);
with LabelPct2 do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Left := ScaleX(370);
Top := PBTop + ScaleY(10);
Width := ScaleX(80);
end;
#endif
LabelTime1 := TLabel.Create(WizardForm);
with LabelTime1 do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Width := 182;
Left := ScaleX(0);
Top := PBTop + ScaleY(35);
end;
LabelTime2 := TLabel.Create(WizardForm);
with LabelTime2 do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Width := LabelTime1.Width+ScaleX(40);
Left := 182;
Top := LabelTime1.Top;
end;
LabelTime3 := TLabel.Create(WizardForm);
with LabelTime3 do begin
Parent := WizardForm.FinishedPage;
AutoSize := False;
Width := 300;
Left := 180;
Top := 200;
end;
MyCancelButton:=TButton.Create(WizardForm);
with MyCancelButton do begin
Parent:=WizardForm;
Width:=ScaleX(135);
Caption:=ExpandConstant('{cm:CancelButton}');
Left:=ScaleX(360);
Top:=WizardForm.cancelbutton.top;
OnClick:=@CancelButtonOnClick;
end;
end;

Procedure CurPageChanged(CurPageID: Integer);
Begin
if (CurPageID = wpFinished) and ISDoneError then
begin
LabelTime3.Hide;
WizardForm.Caption:= ExpandConstant('{cm:Error}');
WizardForm.FinishedLabel.Font.Color:= clRed;
WizardForm.FinishedLabel.Caption:= SetupMessage(msgSetupAborted) ;
end;
end;

function CheckError:boolean;
begin
result:= not ISDoneError;
end;

procedure CurStepChanged(CurStep: TSetupStep);
var Comps1,Comps2,Comps3, TmpValue:cardinal;
FindHandle1,ColFiles1,CurIndex1,tmp:integer;
ExecError:boolean;
InFilePath,OutFilePath,OutFileName:PAnsiChar;
begin
if CurStep = ssInstall then begin //Если необходимо, можно поменять на ssPostInstall
WizardForm.ProgressGauge.Hide;
WizardForm.CancelButton.Hide;
CreateControls;
WizardForm.StatusLabel.Caption:=ExpandConstant('{cm:Extracted}');
ISDoneCancel:=0;

// Распаковка всех необходимых файлов в папку {tmp}.

ExtractTemporaryFile('unarc.dll');

#ifdef PrecompInside
ExtractTemporaryFile('CLS-precomp.dll');
ExtractTemporaryFile('packjpg_dll.dll');
ExtractTemporaryFile('packjpg_dll1.dll');
ExtractTemporaryFile('precomp.exe');
ExtractTemporaryFile('zlib1.dll');
#endif
#ifdef SrepInside
ExtractTemporaryFile('CLS-srep.dll');
#endif
#ifdef MSCInside
ExtractTemporaryFile('CLS-MSC.dll');
#endif
#ifdef facompress
ExtractTemporaryFile('facompress.dll'); //ускоряет распаковку .arc архивов.
#endif
#ifdef records
ExtractTemporaryFile('records.inf');
#endif
#ifdef precomp
#if precomp == "0.38"
ExtractTemporaryFile('precomp038.exe');
#else
#if precomp == "0.4"
ExtractTemporaryFile('precomp040.exe');
#else
#if precomp == "0.41"
ExtractTemporaryFile('precomp041.exe');
#else
#if precomp == "0.42"
ExtractTemporaryFile('precomp042.exe');
#else
ExtractTemporaryFile('precomp038.exe');
ExtractTemporaryFile('precomp040.exe');
ExtractTemporaryFile('precomp041.exe');
ExtractTemporaryFile('precomp042.exe');
#endif
#endif
#endif
#endif
#endif
#ifdef unrar
ExtractTemporaryFile('Unrar.dll');
#endif
#ifdef XDelta
ExtractTemporaryFile('XDelta3.dll');
#endif
#ifdef PackZIP
ExtractTemporaryFile('7z.dll');
ExtractTemporaryFile('PackZIP.exe');
#endif

ExtractTemporaryFile('English.ini');

// Подготавливаем переменную, содержащую всю информацию о выделенных компонентах для ISDone.dll
// максимум 96 компонентов.
Comps1:=0; Comps2:=0; Comps3:=0;
#ifdef Components
TmpValue:=1;
if IsComponentSelected('text\rus') then Comps1:=Comps1+TmpValue; //компонент 1
TmpValue:=TmpValue*2;
if IsComponentSelected('text\eng') then Comps1:=Comps1+TmpValue; //компонент 2
TmpValue:=TmpValue*2;
if IsComponentSelected('voice\rus') then Comps1:=Comps1+TmpValue; //компонент 3
TmpValue:=TmpValue*2;
if IsComponentSelected('voice\eng') then Comps1:=Comps1+TmpValue; //компонент 4
// .....
// см. справку
#endif

#ifdef precomp
PCFVer:={#precomp};
#else
PCFVer:=0;
#endif
ISDoneError:=true;
if ISDoneInit(ExpandConstant('{src}\records.inf'), $F777, Comps1,Comps2,Comps3, MainForm.Handle, {#NeedMem}, @ProgressCallback) then begin
repeat
// ChangeLanguage('English');
if not SrepInit('',512,0) then break;
if not PrecompInit('',128,PCFVer) then break;
if not FileSearchInit(true) then break;

if not ISArcExtract ( 0, 0, ExpandConstant('{src}\data.arc'), ExpandConstant('{app}'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;

// далее находятся закомментированые примеры различных функций распаковки (чтобы каждый раз не лазить в справку за примерами)
(*
if not ISArcExtract ( 0, 0, ExpandConstant('{src}\arc.arc'), ExpandConstant('{app}\'), '', false, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
if not IS7ZipExtract ( 0, 0, ExpandConstant('{src}\CODMW2.7z'), ExpandConstant('{app}\data1'), false, '') then break;
if not ISRarExtract ( 0, 0, ExpandConstant('{src}\data_*.rar'), ExpandConstant('{app}'), false, '') then break;
if not ISSRepExtract ( 0, 0, ExpandConstant('{app}\data1024_1024.srep'),ExpandConstant('{app}\data1024.arc'), true) then break;
if not ISPrecompExtract( 0, 0, ExpandConstant('{app}\data.pcf'), ExpandConstant('{app}\data.7z'), true) then break;
if not ISxDeltaExtract ( 0, 0, 0, 640, ExpandConstant('{app}\in.pcf'), ExpandConstant('{app}\*.diff'), ExpandConstant('{app}\out.dat'), false, false) then break;
if not ISPackZIP ( 0, 0, ExpandConstant('{app}\1a1\*'), ExpandConstant('{app}\1a1.pak'), 2, false ) then break;
if not ISExec ( 0, 0, 0, ExpandConstant('{tmp}\Arc.exe'), ExpandConstant('x -o+ "{src}\001.arc" "{app}\"'), ExpandConstant('{tmp}'), '...',false) then break;
if not ShowChangeDiskWindow ('Пожалуйста, вставьте второй диск и дождитесь его инициализации.', ExpandConstant('{src}'),'CODMW_2.arc') then break;

// распаковка группы файлов посредством внешнего приложения

FindHandle1:=ISFindFiles(0,ExpandConstant('{app}\*.ogg'),ColFiles1);
ExecError:=false;
while not ExecError and ISPickFilename(FindHandle1,ExpandConstant('{app}\'),CurIndex1,true) do begin
InFilePath:=ISGetName(0);
OutFilePath:=ISGetName(1);
OutFileName:=ISGetName(2);
ExecError:=not ISExec(0, 0, 0, ExpandConstant('{tmp}\oggdec.exe'), '"'+InFilePath+'" -w "'+OutFilePath+'"',ExpandConstant('{tmp}'),OutFileName,false);
end;
ISFindFree(FindHandle1);
if ExecError then break;
*)

ISDoneError:=false;
until true;
ISDoneStop;
end;
HideControls;
WizardForm.CancelButton.Visible:=true;
WizardForm.CancelButton.Enabled:=false;
end;
if (CurStep=ssPostInstall) and ISDoneError then begin
Exec2(ExpandConstant('{uninstallexe}'), '/VERYSILENT', false);
end;
end;

Nightwishh
12-04-2013, 05:26
Ребят, как поставить SelectDirBitmapImage на передний план (создал BitmapImage1, а она закрывает собой SelectDirBitmapImage), допустим в этом коде
[Setup]
AppName=еоркпркр
AppVerName=нркркрк
DefaultDirName={pf}\карпапрапр

[Files]
Source: Background.bmp; Flags: dontcopy solidbreak

[ Code]
var
BitmapImage1: TBitmapImage;

procedure InitializeWizard();
begin
WizardForm.SelectDirBitmapImage.Top:= ScaleY(9);

BitmapImage1 := TBitmapImage.Create(WizardForm);
with BitmapImage1 do
begin
Parent := WizardForm.SelectDirPage;
Left := ScaleX(0);
Top := ScaleY(9);
Width := ScaleX(305);
Height := ScaleY(305);
Stretch := True;
ExtractTemporaryFile('Background.bmp');
Bitmap.LoadFromFile(ExpandConstant('{tmp}\Background.bmp'));
end;
end; Но не создавая новою картинку!
2) И в чём разница между Hide и Visible:= false? и что лучше?

Gnom_aka_Lexander
12-04-2013, 08:20
Nightwishh, у большинства контролов есть свойство BringToFront, которое перемещает на передний план.2) И в чём разница между Hide и Visible:= false? и что лучше? »
В целом никакой. Visible является ReadWrite, тоесть как задаваемым, так и возврящаемым. иногда можно для краткости его успользовать. например, когда имеет место конструкция if(условие)then MyCtrl.Show; то быстрей будет так: MyCtrl.Visible:= (условие); По крайней мере такая конструкция на одну операцию меньше.

ABBAT
12-04-2013, 16:00
Всем привет. Делаю скрипт Adobe Flash Player (вроде работает) и у меня секция InitializeSetup получилась громоздкая и соответственно долгий запуск. Может кто что посоветует.
Выкладываю полностью скрипт (может кому пригодится)


; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
;#define FlashPlayerVer ""

#define FlashPlayer32 "NPSWF32_11_7_700_169.dll"
#define FlashPlayer64 "NPSWF64_11_7_700_169.dll"
#define ActiveX32 "Flash32_11_7_700_169.ocx"
#define ActiveX64 "Flash64_11_7_700_169.ocx"

#define Ver "11,7,700,169"
#define ActiveXVer "11.7.700.169"
#define FlashPlayerVer "11.7.700.169"
#define AppVer GetFileVersion(AddBackslash(SourcePath) + 'System32\NPSWF64_11_7_700_169.dll')


#define AppName "Adobe Flash Player"
#define AppCopyright "© 1982-" + GetDateTimeString ("yyyy", "", "") + " Adobe Systems Inc."
#define AppURL "http://www.adobe.com"
#define AppDescription "Adobe Flash Player " + AppVer + "
#define AppPub "Adobe Systems Incorporated"
#define AppURL "http://www.adobe.com/ru/products/flashplayer.html"






[Setup]
AppName={#AppName}
AppVersion={#AppVer}
AppPublisher={#AppCopyright}
VersionInfoDescription = {#AppDescription}
AppCopyright={#AppCopyright}
VersionInfoVersion={#AppVer}
DefaultDirName={sys}
AllowNoIcons=yes
OutputDir=.
OutputBaseFilename=Flash
SetupIconFile=4105.ico
Compression=lzma2/ultra64
SolidCompression=true
InternalCompressLevel=ultra64
ArchitecturesInstallIn64BitMode=x64
ArchitecturesAllowed=x64 x86
DisableFinishedPage=true
DisableReadyPage=true
DisableDirPage=true
DisableProgramGroupPage=true
DirExistsWarning=no
DisableStartupPrompt=yes
DisableReadyMemo=yes
RestartIfNeededByRun=no
CreateUninstallRegKey=no
Uninstallable=no
CompressionThreads=8
LZMAUseSeparateProcess=yes
LZMANumBlockThreads=4
CloseApplications=false
RestartApplications=false

[Languages]
Name: russian; MessagesFile: compiler:Languages\Russian.isl


[Files]
Source: "System32\*"; DestDir: "{sys}\Macromed\Flash"; Check: IsWin64; Flags: recursesubdirs createallsubdirs ignoreversion; BeforeInstall: CreateBackup
Source: "SysWOW64\*"; DestDir: "{syswow64}\Macromed\Flash"; Check: IsWin64; Flags: recursesubdirs createallsubdirs ignoreversion; BeforeInstall: CreateBackup
Source: "SysWOW64\*"; DestDir: "{sys}\Macromed\Flash";Check: not IsWin64; Flags: recursesubdirs createallsubdirs ignoreversion; BeforeInstall: CreateBackup
Source: "activexSysWOW64\*"; DestDir: "{sys}\Macromed\Flash";Check: not IsWin64; Flags: recursesubdirs createallsubdirs ignoreversion; BeforeInstall: CreateBackup; OnlyBelowVersion: 0,6.2
Source: "activexSysWOW64\*"; DestDir: "{syswow64}\Macromed\Flash";Check: IsWin64; Flags: recursesubdirs createallsubdirs ignoreversion; BeforeInstall: CreateBackup; OnlyBelowVersion: 0,6.2
Source: "activexX32\*"; DestDir: "{sys}\Macromed\Flash";Check: IsWin64; Flags: recursesubdirs createallsubdirs ignoreversion; BeforeInstall: CreateBackup; OnlyBelowVersion: 0,6.2
Source: "FlashPlayerCPLApp.cpl"; DestDir: "{syswow64}"; Flags: ignoreversion; Check: IsWin64; OnlyBelowVersion: 0,6.2
Source: "FlashPlayerCPLApp.cpl"; DestDir: "{sys}"; Flags: ignoreversion; Check: not IsWin64; OnlyBelowVersion: 0,6.2

Source: "{sys}\Macromed\Flash\{#ActiveX64}"; DestDir: "{sys}\Macromed\Flash"; Check: IsWin64; Flags: external ignoreversion regserver; OnlyBelowVersion: 0,6.2
Source: "{syswow64}\Macromed\Flash\{#ActiveX32}"; DestDir: "{syswow64}\Macromed\Flash"; Flags: external ignoreversion regserver; OnlyBelowVersion: 0,6.2

Source: "FlashPlayerApp.exe"; DestDir: "{sys}"; Check: not IsWin64; Flags: ignoreversion;
Source: "FlashPlayerApp.exe"; DestDir: "{syswow64}"; Check: IsWin64; Flags: ignoreversion;


Source: "Uninstall.exe"; DestDir: "{sys}\Macromed\Flash"; Flags: ignoreversion

[InstallDelete]
Name: "{sys}\Macromed\*"; Type: filesandordirs
Name: "{syswow64}\Macromed\*"; Type: filesandordirs; Check: IsWin64;


[Registry]
Root: HKLM; SubKey: SOFTWARE\Macromedia\FlashPlayer; ValueType: string; ValueName: CurrentVersion; ValueData: {#Ver}; Check: IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Macromedia\FlashPlayerActiveX; ValueType: string; ValueName: Version; ValueData: {#ActiveXVer}; Check: IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Macromedia\FlashPlayerActiveX; ValueType: string; ValueName: PlayerPath; ValueData: {sys}\Macromed\Flash\{#ActiveX64}; Check: IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Macromedia\FlashPlayerPlugin; ValueType: string; ValueName: Version; ValueData: {#AppVer}; Check: IsWin64;
Root: HKLM; SubKey: SOFTWARE\Macromedia\FlashPlayerPlugin; ValueType: string; ValueName: PlayerPath; ValueData: {sys}\Macromed\Flash\{#FlashPlayer64}; Check: IsWin64;
Root: HKLM; SubKey: SOFTWARE\Macromedia\FlashPlayerPlugin; ValueType: string; ValueName: UninstallerPath; ValueData: {sys}\Macromed\Flash\Uninstall.exe; Check: IsWin64;
Root: HKLM; SubKey: SOFTWARE\MozillaPlugins\@adobe.com/FlashPlayer; ValueType: string; ValueName: Path; ValueData:{sys}\Macromed\Flash\{#FlashPlayer64}; Check: IsWin64;
Root: HKLM; SubKey: SOFTWARE\MozillaPlugins\@adobe.com/FlashPlayer; ValueType: string; ValueName: ProductName; ValueData: Adobe® Flash® Player {#AppVer} Plugin; Check: IsWin64;
Root: HKLM; SubKey: SOFTWARE\MozillaPlugins\@adobe.com/FlashPlayer; ValueType: string; ValueName: Vendor; ValueData: Adobe Systems Incorporated; Check: IsWin64;
Root: HKLM; SubKey: SOFTWARE\MozillaPlugins\@adobe.com/FlashPlayer; ValueType: string; ValueName: Description; ValueData: Adobe® Flash® Player {#AppVer} Plugin; Check: IsWin64;
Root: HKLM; SubKey: SOFTWARE\MozillaPlugins\@adobe.com/FlashPlayer; ValueType: string; ValueName: Version; ValueData: {#AppVer}; Check: IsWin64;

Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player ActiveX; ValueType: string; ValueName: DisplayName; ValueData: Adobe Flash Player 11 ActiveX & Plugin 64-bit; Check: IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player ActiveX; ValueType: string; ValueName: Publisher; ValueData: Adobe Systems Incorporated; Check: IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player ActiveX; ValueType: string; ValueName: DisplayVersion; ValueData: {#AppVer}; Check: IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player ActiveX; ValueType: string; ValueName: HelpLink; ValueData: http://www.adobe.com/go/flashplayer_support/ ; Check: IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player ActiveX; ValueType: dword; ValueName: NoModify; ValueData: $00000001; Check: IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player ActiveX; ValueType: dword; ValueName: NoRepair; ValueData: $00000001; Check: IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player ActiveX; ValueType: string; ValueName: URLInfoAbout; ValueData: http://www.adobe.com ; Check: IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player ActiveX; ValueType: string; ValueName: URLUpdateInfo; ValueData: http://www.adobe.com/go/getflashplayer/ ; Check: IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player ActiveX; ValueType: string; ValueName: UninstallString; ValueData: {sys}\Macromed\Flash\Uninstall.exe -maintain; Check: IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player ActiveX; ValueType: string; ValueName: DisplayIcon; ValueData: {sys}\Macromed\Flash\Uninstall.exe; Check: IsWin64; OnlyBelowVersion: 0,6.2

Root: HKLM; SubKey: SOFTWARE\Wow6432Node\Macromedia\FlashPlayer; ValueType: string; ValueName: CurrentVersion; ValueData: {#Ver}; Check: IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Wow6432Node\Macromedia\FlashPlayerActiveX; ValueType: string; ValueName: Version; ValueData: {#ActiveXVer}; Check: IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Wow6432Node\Macromedia\FlashPlayerActiveX; ValueType: string; ValueName: PlayerPath; ValueData: {syswow64}\Macromed\Flash\{#ActiveX32}; Check: IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Wow6432Node\Macromedia\FlashPlayerPlugin; ValueType: string; ValueName: Version; ValueData: {#AppVer}; Check: IsWin64;
Root: HKLM; SubKey: SOFTWARE\Wow6432Node\Macromedia\FlashPlayerPlugin; ValueType: string; ValueName: PlayerPath; ValueData: {syswow64}\Macromed\Flash\{#FlashPlayer32}; Check: IsWin64;
;Root: HKLM; SubKey: SOFTWARE\Wow6432Node\Macromedia\FlashPlayerPlugin\Components; ValueType: string; ValueName: Main; ValueData: 1; Check: IsWin64;
Root: HKLM; SubKey: SOFTWARE\Wow6432Node\Macromedia\FlashPlayerPlugin; ValueName: isScriptDebugger; ValueData: 00000000; ValueType: dword; Check: IsWin64;
Root: HKLM; SubKey: SOFTWARE\Wow6432Node\MozillaPlugins\@adobe.com/FlashPlayer; ValueType: string; ValueName: ProductName; ValueData: Adobe® Flash® Player {#AppVer} Plugin; Check: IsWin64;
Root: HKLM; SubKey: SOFTWARE\Wow6432Node\MozillaPlugins\@adobe.com/FlashPlayer; ValueType: string; ValueName: Path; ValueData: {syswow64}\Macromed\Flash\{#FlashPlayer32}; Check: IsWin64;
Root: HKLM; SubKey: SOFTWARE\Wow6432Node\MozillaPlugins\@adobe.com/FlashPlayer; ValueType: string; ValueName: Vendor; ValueData: Adobe Systems Incorporated; Check: IsWin64;
Root: HKLM; SubKey: SOFTWARE\Wow6432Node\MozillaPlugins\@adobe.com/FlashPlayer; ValueType: string; ValueName: Description; ValueData: Adobe® Flash® Player {#AppVer} Plugin; Check: IsWin64;
Root: HKLM; SubKey: SOFTWARE\Wow6432Node\MozillaPlugins\@adobe.com/FlashPlayer; ValueType: string; ValueName: Version; ValueData: {#AppVer}; Check: IsWin64;
Root: HKLM; SubKey: SOFTWARE\Wow6432Node\MozillaPlugins\@adobe.com/FlashPlayer; ValueType: string; ValueName: XPTPath; ValueData: {syswow64}\Macromed\Flash\flashplayer.xpt; Check: IsWin64;
Root: HKCU; SubKey: Software\Macromedia\FlashPlayer; ValueType: string; ValueName: FlashPlayerVersion; ValueData: "{#ActiveXVer}~installVector=1"; OnlyBelowVersion: 0,6.2
;___________________________________________________________________________________________________ __

Root: HKLM; SubKey: SOFTWARE\Macromedia\FlashPlayer; ValueType: string; ValueName: CurrentVersion; ValueData: {#Ver};Check: not IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Macromedia\FlashPlayerActiveX; ValueType: string; ValueName: Version; ValueData: {#ActiveXVer};Check: not IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Macromedia\FlashPlayerActiveX; ValueType: string; ValueName: Path; ValueData: {sys}\Macromed\Flash;Check: not IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Macromedia\FlashPlayerActiveX; ValueType: string; ValueName: PlayerPath; ValueData: {sys}\Macromed\Flash\{#ActiveX32};Check: not IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Macromedia\FlashPlayerPlugin\Components; ValueType: string; ValueName: Main; ValueData: 1;Check: not IsWin64;
Root: HKLM; SubKey: SOFTWARE\Macromedia\FlashPlayerPlugin; ValueType: string; ValueName: Version; ValueData: {#AppVer};Check: not IsWin64;
Root: HKLM; SubKey: SOFTWARE\Macromedia\FlashPlayerPlugin; ValueType: string; ValueName: PlayerPath; ValueData: {sys}\Macromed\Flash\{#FlashPlayer32};Check: not IsWin64;
Root: HKLM; SubKey: SOFTWARE\Macromedia\FlashPlayerPlugin; ValueType: string; ValueName: Path; ValueData: {sys}\Macromed\Flash\{#FlashPlayer32};Check: not IsWin64;
Root: HKLM; SubKey: SOFTWARE\Macromedia\FlashPlayerPlugin; ValueName: isScriptDebugger; ValueData: 00000000; ValueType: dword; Check: not IsWin64;
Root: HKLM; SubKey: SOFTWARE\MozillaPlugins\@adobe.com/FlashPlayer; ValueType: string; ValueName: Path; ValueData: {sys}\Macromed\Flash\{#FlashPlayer32};Check: not IsWin64;
Root: HKLM; SubKey: SOFTWARE\MozillaPlugins\@adobe.com/FlashPlayer; ValueType: string; ValueName: ProductName; ValueData: Adobe® Flash® Player {#AppVer} Plugin;Check: not IsWin64;
Root: HKLM; SubKey: SOFTWARE\MozillaPlugins\@adobe.com/FlashPlayer; ValueType: string; ValueName: Vendor; ValueData: Adobe Systems Incorporated;Check: not IsWin64;
Root: HKLM; SubKey: SOFTWARE\MozillaPlugins\@adobe.com/FlashPlayer; ValueType: string; ValueName: Description; ValueData: Adobe® Flash® Player {#AppVer} Plugin;Check: not IsWin64;
Root: HKLM; SubKey: SOFTWARE\MozillaPlugins\@adobe.com/FlashPlayer; ValueType: string; ValueName: Version; ValueData: {#AppVer};Check: not IsWin64;
Root: HKLM; SubKey: SOFTWARE\MozillaPlugins\@adobe.com/FlashPlayer; ValueType: string; ValueName: XPTPath; ValueData: {sys}\Macromed\Flash\flashplayer.xpt;Check: not IsWin64;

Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player ActiveX; ValueType: string; ValueName: DisplayName; ValueData: Adobe Flash Player 11 ActiveX & Plugin;Check: not IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player ActiveX; ValueType: string; ValueName: Publisher; ValueData: Adobe Systems Incorporated;Check: not IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player ActiveX; ValueType: string; ValueName: DisplayVersion; ValueData: {#AppVer};Check: not IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player ActiveX; ValueType: string; ValueName: HelpLink; ValueData: http://www.adobe.com/go/flashplayer_support/ ;Check: not IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player ActiveX; ValueType: dword; ValueName: NoModify; ValueData: $00000001;Check: not IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player ActiveX; ValueType: dword; ValueName: NoRepair; ValueData: $00000001;Check: not IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player ActiveX; ValueType: string; ValueName: RequiresIESysFile; ValueData: 4.70.0.1155;Check: not IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player ActiveX; ValueType: string; ValueName: URLInfoAbout; ValueData: http://www.adobe.com ;Check: not IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player ActiveX; ValueType: string; ValueName: URLUpdateInfo; ValueData: http://www.adobe.com/go/getflashplayer/ ;Check: not IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player ActiveX; ValueType: dword; ValueName: VersionMajor; ValueData: $0000000b;Check: not IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player ActiveX; ValueType: dword; ValueName: VersionMinor; ValueData: $00000000;Check: not IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player ActiveX; ValueType: string; ValueName: UninstallString; ValueData: {sys}\Macromed\Flash\Uninstall.exe -maintain ;Check: not IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player ActiveX; ValueType: string; ValueName: DisplayIcon; ValueData: {sys}\Macromed\Flash\Uninstall.exe ;Check: not IsWin64; OnlyBelowVersion: 0,6.2
; win 8
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player Plugin; ValueType: string; ValueName: DisplayName; ValueData: Adobe Flash Player 11 Plugin ; MinVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player Plugin; ValueType: string; ValueName: Publisher; ValueData: Adobe Systems Incorporated; MinVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player Plugin; ValueType: string; ValueName: DisplayVersion; ValueData: {#AppVer}; MinVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player Plugin; ValueType: string; ValueName: HelpLink; ValueData: http://www.adobe.com/go/flashplayer_support/ ; MinVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player Plugin; ValueType: dword; ValueName: NoModify; ValueData: $00000001; MinVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player Plugin; ValueType: dword; ValueName: NoRepair; ValueData: $00000001; MinVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player Plugin; ValueType: string; ValueName: RequiresIESysFile; ValueData: 4.70.0.1155; MinVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player Plugin; ValueType: string; ValueName: URLInfoAbout; ValueData: http://www.adobe.com ; MinVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player Plugin; ValueType: string; ValueName: URLUpdateInfo; ValueData: http://www.adobe.com/go/getflashplayer/ ; MinVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player Plugin; ValueType: dword; ValueName: VersionMajor; ValueData: $0000000b ; MinVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player Plugin; ValueType: dword; ValueName: VersionMinor; ValueData: $00000007 ; MinVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player Plugin; ValueType: string; ValueName: UninstallString; ValueData: {sys}\Macromed\Flash\Uninstall.exe -maintain plugin ; MinVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player Plugin; ValueType: string; ValueName: DisplayIcon; ValueData: {sys}\Macromed\Flash\Uninstall.exe ; MinVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player Plugin; ValueType: dword; ValueName: EstimatedSize; ValueData: $00001800; MinVersion: 0,6.2

Root: HKLM; SubKey: SOFTWARE\Wow6432Node\Macromedia\FlashPlayer\SafeVersions; ValueType: dword; ValueName: 6.0; ValueData: $ffffffff ;Check: IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Wow6432Node\Macromedia\FlashPlayer\SafeVersions; ValueType: dword; ValueName: 7.0; ValueData: $ffffffff ;Check: IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Wow6432Node\Macromedia\FlashPlayer\SafeVersions; ValueType: dword; ValueName: 8.0; ValueData: $ffffffff ;Check: IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Wow6432Node\Macromedia\FlashPlayer\SafeVersions; ValueType: dword; ValueName: 9.0; ValueData: $ffffffff ;Check: IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Wow6432Node\Macromedia\FlashPlayer\SafeVersions; ValueType: dword; ValueName: 10.0; ValueData: $00e6001e ;Check: IsWin64; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Wow6432Node\Macromedia\FlashPlayer\SafeVersions; ValueType: dword; ValueName: 11.0; ValueData: $02bc00a9 ;Check: IsWin64; OnlyBelowVersion: 0,6.2

Root: HKLM; SubKey: SOFTWARE\Macromedia\FlashPlayer\SafeVersions; ValueType: dword; ValueName: 6.0; ValueData: $ffffffff; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Macromedia\FlashPlayer\SafeVersions; ValueType: dword; ValueName: 7.0; ValueData: $ffffffff; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Macromedia\FlashPlayer\SafeVersions; ValueType: dword; ValueName: 8.0; ValueData: $ffffffff; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Macromedia\FlashPlayer\SafeVersions; ValueType: dword; ValueName: 9.0; ValueData: $ffffffff; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Macromedia\FlashPlayer\SafeVersions; ValueType: dword; ValueName: 10.0; ValueData: $00e6001e; OnlyBelowVersion: 0,6.2
Root: HKLM; SubKey: SOFTWARE\Macromedia\FlashPlayer\SafeVersions; ValueType: dword; ValueName: 11.0; ValueData: $02bc00a9; OnlyBelowVersion: 0,6.2



[_code]

var
ResultStr:string;
ResultCode: Integer;
Mask: string;

function FindFileByMask(Path, Mask: string): Boolean;
var
FSR: TFindRec;
FindResult: Boolean;
begin
Result:= False;
if Path[Length(Path)] <> '\' then Path:= Path + '\';
FindResult:= FindFirst(Path + Mask, FSR);
try
while FindResult do
begin
if FSR.Attributes and FILE_ATTRIBUTE_DIRECTORY = 0 then
begin
Result:= True;
Exit;
end;
FindResult:= FindNext(FSR);
end;
finally
FindClose(FSR);
end;
end;

function InitializeSetup(): Boolean;
var
ErCode: Integer;
begin
Exec('taskkill', '/f /im iexplore.exe', '', SW_HIDE, ewWaitUntilTerminated, ErCode);
Exec('taskkill', '/f /im firefox.exe', '', SW_HIDE, ewWaitUntilTerminated, ErCode);
ExtractTemporaryFile('Uninstall.exe');

begin
if ((GetWindowsVersion shr 24) <= 6) and (((GetWindowsVersion shr 16) and $FF) <= 1)
then begin
if FindFileByMask(ExpandConstant('{sys}\Macromed\Flash'), 'NPSWF*.dll') = True then begin//MsgBox('ok', mbInformation, MB_OK);
// ExtractTemporaryFile('Uninstall.exe');
Exec(ExpandConstant('{tmp}\Uninstall.exe'), '-maintain', '', SW_SHOW, ewWaitUntilTerminated, ResultCode)
end
if FindFileByMask(ExpandConstant('{sys}\Macromed\Flash'), 'NPSWF*.dll') = True then begin
Result := False;
exit;
end else
Result := True;

if IsWin64 then
begin
if FindFileByMask(ExpandConstant('{syswow64}\Macromed\Flash'), 'NPSWF*.dll') = True then begin
// ExtractTemporaryFile('Uninstall.exe');
Exec(ExpandConstant('{tmp}\Uninstall.exe'), '-maintain', '', SW_SHOW, ewWaitUntilTerminated, ResultCode)
end;
if FindFileByMask(ExpandConstant('{syswow64}\Macromed\Flash'), 'NPSWF*.dll') = True then begin
Result := False;
exit;
end else
Result := True;
end;
begin
if FindFileByMask(ExpandConstant('{sys}\Macromed\Flash'), '*.ocx') = True then begin//MsgBox('ok', mbInformation, MB_OK);
// ExtractTemporaryFile('Uninstall.exe');
Exec(ExpandConstant('{tmp}\Uninstall.exe'), '-maintain', '', SW_SHOW, ewWaitUntilTerminated, ResultCode)
end
if FindFileByMask(ExpandConstant('{sys}\Macromed\Flash'), '*.ocx') = True then begin
Result := False;
exit;
end else
Result := True;
end;
begin
if IsWin64 then
begin
if FindFileByMask(ExpandConstant('{syswow64}\Macromed\Flash'), '*.ocx') = True then begin
// ExtractTemporaryFile('Uninstall.exe');
Exec(ExpandConstant('{tmp}\Uninstall.exe'), '-maintain', '', SW_SHOW, ewWaitUntilTerminated, ResultCode)
end;
if FindFileByMask(ExpandConstant('{syswow64}\Macromed\Flash'), '*.ocx') = True then begin
Result := False;
exit;
end else
Result := True;
end;
end;
end;
end;
begin
if ((GetWindowsVersion shr 24) >= 6) and (((GetWindowsVersion shr 16) and $FF) >= 2)
then begin
if FindFileByMask(ExpandConstant('{sys}\Macromed\Flash'), 'NPSWF*.dll') = True then begin//MsgBox('ok', mbInformation, MB_OK);
// ExtractTemporaryFile('Uninstall.exe');
Exec(ExpandConstant('{tmp}\Uninstall.exe'), '-maintain', '', SW_SHOW, ewWaitUntilTerminated, ResultCode)
end
if FindFileByMask(ExpandConstant('{sys}\Macromed\Flash'), 'NPSWF*.dll') = True then begin
Result := False;
exit;
end else
Result := True;

if IsWin64 then
begin
if FindFileByMask(ExpandConstant('{syswow64}\Macromed\Flash'), 'NPSWF*.dll') = True then begin
// ExtractTemporaryFile('Uninstall.exe');
Exec(ExpandConstant('{tmp}\Uninstall.exe'), '-maintain', '', SW_SHOW, ewWaitUntilTerminated, ResultCode)
end;
if FindFileByMask(ExpandConstant('{syswow64}\Macromed\Flash'), 'NPSWF*.dll') = True then begin
Result := False;
exit;
end else
Result := True;
end;
end;
end;
end;


procedure CreateBackup;
var
srcFile, destFile: string;
begin
srcFile:= ExpandConstant(CurrentFileName);
destFile:= srcFile + '.bak';
DeleteFile(destFile);
RenameFile(srcFile, destFile);
end;

procedure InitializeWizard();
begin
with WizardForm do SetBounds(-Left*5, -Top*5, Width, Height);
end;

procedure CurPageChanged(CurPageID: Integer);
begin
PostMessage(WizardForm.NextButton.Handle, 245, 0, 0);
end;

Johny777
12-04-2013, 20:24
ABBAT,
1. было слишком много логических скобок begin end;
2. лишние глобальные переменные и тяжёлая функция поиска по маске
3. не вдавался в значение кода, просто переписал, удалил лишнее и оптимизировал
4. используй по возможности const во входных параметрах функций/процедур, тк стек не резиновый
5. чтоб не гонять лишний раз функцию ExpandConstant() лучше 1 раз записать повторяющиеся пути в переменные,
короче изучай:


function FindFileByExt(const SearchPath, Extension: String): Boolean;
var
FindRec: TFindRec;
begin
try
Result := FindFirst(AddBackslash(RemoveBackslash(SearchPath)) + Extension, FindRec);
finally
FindClose(FindRec);
end;
end;

function InitializeSetup(): Boolean;
var
Syswow64Path, SysPath, TempPath: String;
ErrorCode: Integer;
WinVersion: Cardinal;
begin
if MsgBox('Для установки будут закрыты браузеры если они открыты. Продолжить?', mbConfirmation, MB_YESNO) = IDNO then Exit;

Exec('taskkill', '/f /im iexplore.exe', '', SW_HIDE, ewWaitUntilTerminated, ErrorCode);
Exec('taskkill', '/f /im firefox.exe', '', SW_HIDE, ewWaitUntilTerminated, ErrorCode);
ExtractTemporaryFile('Uninstall.exe');

Syswow64Path := AddBackslash(RemoveBackslash(ExpandConstant('{syswow64}')));
SysPath := AddBackslash(RemoveBackslash(ExpandConstant('{sys}')));
TempPath := AddBackslash(RemoveBackslash(ExpandConstant('{tmp}')));
WinVersion := GetWindowsVersion;

if ((WinVersion shr 24) <= 6) and (((WinVersion shr 16) and $FF) <= 1) then
begin
if FindFileByExt(SysPath + 'Macromed\Flash', 'NPSWF*.dll') then Exec(TempPath + 'Uninstall.exe', '-maintain', '', SW_SHOW, ewWaitUntilTerminated, ErrorCode);
Result := not FindFileByExt(SysPath + 'Macromed\Flash', 'NPSWF*.dll');
if not Result then Exit;
if IsWin64 then
begin
if FindFileByExt(Syswow64Path + 'Macromed\Flash', 'NPSWF*.dll') then Exec(TempPath + 'Uninstall.exe', '-maintain', '', SW_SHOW, ewWaitUntilTerminated, ErrorCode);
Result := not FindFileByExt(Syswow64Path + 'Macromed\Flash', 'NPSWF*.dll');
if not Result then Exit;

if FindFileByExt(Syswow64Path + 'Macromed\Flash', '*.ocx') then Exec(TempPath + 'Uninstall.exe', '-maintain', '', SW_SHOW, ewWaitUntilTerminated, ErrorCode);
Result := not FindFileByExt(Syswow64Path + 'Macromed\Flash', '*.ocx');
if not Result then Exit;
end;
if FindFileByExt(SysPath + 'Macromed\Flash', '*.ocx') then Exec(TempPath + 'Uninstall.exe', '-maintain', '', SW_SHOW, ewWaitUntilTerminated, ErrorCode);
Result := not FindFileByExt(SysPath + 'Macromed\Flash', '*.ocx');
if not Result then Exit;
end else if ((WinVersion shr 24) >= 6) and (((WinVersion shr 16) and $FF) >= 2) then
begin
if FindFileByExt(SysPath + 'Macromed\Flash', 'NPSWF*.dll') then Exec(TempPath + 'Uninstall.exe', '-maintain', '', SW_SHOW, ewWaitUntilTerminated, ErrorCode);
Result := not FindFileByExt(SysPath + 'Macromed\Flash', 'NPSWF*.dll');
if not Result then Exit;
if IsWin64 then
begin
if FindFileByExt(Syswow64Path + 'Macromed\Flash', 'NPSWF*.dll') then Exec(TempPath + 'Uninstall.exe', '-maintain', '', SW_SHOW, ewWaitUntilTerminated, ErrorCode);
Result := not FindFileByExt(Syswow64Path + 'Macromed\Flash', 'NPSWF*.dll');
end;
end;
end;




PS: делай нормальные отступы чтоб было читабельно и тебе и другим (лучший пример El Sanchez)
Некрасиво убивать процесс барузера не спросив или не предупредив пользователя! А вдруг там что-то скачивается?

neorom
12-04-2013, 20:35
З процентами я розобрался на 99.9%. Остался последний вопрос.
Например, чтоби при просмотре замисть 67% било 67.0% (проценти 67.1% єсть )на екране процентов http://s3.share.te.ua/499155/procent_1.jpg (http://s3.share.te.ua/b499155/procent_1.jpg) зделать так http://s3.share.te.ua/499156/procent_2.jpg (http://s3.share.te.ua/b499156/procent_2.jpg)
Додаю скрипт [Setup]
AppName=MyApp
AppVerName=MyApp
DefaultDirName={pf}\MyApp

[Files]
Source: innocallback.dll; DestDir: {tmp}; Flags: dontcopy
Source: files\*; DestDir: {app}; Flags: recursesubdirs

[Code]
type
TTimerProc = procedure(HandleW, Msg, idEvent, TimeSys: LongWord);
var
TimerID: LongWord;
PercentsLabel: TLabel;

function WrapTimerProc(callback: TTimerProc; Paramcount: Integer): longword; external 'wrapcallback@files:innocallback.dll stdcall';
function SetTimer(hWnd, nIDEvent, uElapse, lpTimerFunc: LongWord): longword; external 'SetTimer@user32';
function KillTimer(hWnd, nIDEvent: LongWord): LongWord; external 'KillTimer@user32 stdcall delayload';

Function NumToStr(Float: Extended): String;
Begin
Result:= Format('%.1n', [Float]); StringChange(Result, ',', '.');
while ((Result[Length(Result)] = '0') or (Result[Length(Result)] = '.')) and (Pos('.', Result) > 0) do
SetLength(Result, Length(Result)-1);
End;

procedure PercentsInstall();
begin
with WizardForm.ProgressGauge do
begin
PercentsLabel.Caption:= 'Установка игры: ' + NumToStr((Position*100)/Max) + ' %';
end;
end;

Procedure MyTimerProc(h, msg, idevent, dwTime: Longword);
Begin
if WizardForm.CurPageID = wpInstalling then PercentsInstall();
End;

procedure DeinitializeSetup();
begin
KillTimer(0, TimerID);
end;

procedure InitializeWizard();
begin
PercentsLabel:= TLabel.Create(WizardForm);
with PercentsLabel do
begin
Left:= WizardForm.DirEdit.Left;
Top:= WizardForm.DirEdit.Top + WizardForm.DirEdit.Height + ScaleY(30);
Width:= WizardForm.StatusLabel.Width;
Height:= WizardForm.StatusLabel.Height;
AutoSize:= False;
Transparent := True;
Alignment := taCenter;
Font.Style:= [fsBold, fsItalic];
Font.Size:= 14;
Font.Name:= 'Times New Roman';
Font.Color:= ClMaroon;
Parent:= WizardForm.InstallingPage;
end;
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssInstall then
begin
TimerID:= SetTimer(0, 0, 500 {Установка игры}, WrapTimerProc(@MyTimerProc, 4));
end;
end;

ABBAT
12-04-2013, 22:02
Johny777,
Спасибо дружище. Хороший код, но, если нажать на отмену, то установщик 4 раза предлагает удалить и только патом закрывается. (есть идеи как обойти?)
Некрасиво убивать процесс барузера не спросив или не предупредив пользователя! А вдруг там что-то скачивается? »
Прикрутил проверку на поиск процесса (в шапке есть пример, иначе при интеграции в дистр будет вываливаться окно с запросом закрыть браузеры ыыы (отличный получился бы прикол))

Johny777
12-04-2013, 22:49
ABBAT,
потому что не тестил за неимением пакуемых файлов, а искать надлежащие файлы для скрипта у меня нет времени
короче исправил пред. пост, тестируй

ABBAT
13-04-2013, 00:31
Johny777,
Спасибо большое вроде все как надо работает (на Win8 не тестил)
Файлы я беру в ветке "Наборы обновлений для Windows..." тема FullFlash аддон 'mPaSoft' он Flash в 7z пакует.
(я бы может и не парился но у него он такой страшный, в 7z батники, файлы реестра. (удивляюсь как это все работает, но работает же ыыы))
Вот скрипт (http://yadi.sk/d/JDxlgS5-404mb) со всем необходимым для создания аддона Adobe Flash Player 11 ActiveX & Plugin
Спасибо Johny777 за помощь.

habib2302
13-04-2013, 14:48
люди.я незнаю как это вам объяснить.короче.помогите мне пожалуйста разделить мне мой скрипт от AIDA64 на части.например.1 часть это кликабельное лого без фона,2 часть wizardimage и wazardsmallimage без фона,3 часть это поменять местами страницы Select dir и select components и т.п.а то я запутался в своем скрипте.вот скрипт

; Скрипт создан через Мастер Inno Setup Script.
; ИСПОЛЬЗУЙТЕ ДОКУМЕНТАЦИЮ ДЛЯ ПОДРОБНОСТЕЙ ИСПОЛЬЗОВАНИЯ INNO SETUP!

#define MyAppName "AIDA64"
#define MyAppVersion "2.85.2400"
#define MyAppPublisher "Copyright (c) 1995-2013 FinalWire Ltd."
#define MyAppURL "http://www.aida64.com/"
#define AIDA641 "AIDA64 Extreme Edition"
#define AIDA642 "AIDA64 Business Edition"
#define AIDA64EXE1 "aida64.exe"
#define AIDA64EXE2 "aida64.exe"
#define AuthRep "Xabib"
#include "WinTB.iss"
#include "botva2.iss"

[Setup]
; Примечание: Значение AppId идентифицирует это приложение.
; Не используйте одно и тоже значение в разных установках.
; (Для генерации значения GUID, нажмите Инструменты | Генерация GUID.)
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\FinalWire
DefaultGroupName=FinalWire
AllowNoIcons=true
OutputBaseFilename={#MyAppName} {#MyAppVersion}
SetupIconFile=ico.ico
Compression=lzma/Ultra64
SolidCompression=true
InternalCompressLevel=Ultra64
DiskSpanning=false
DiskSliceSize=736000000
ShowLanguageDialog=auto
SlicesPerDisk=4
UninstallDisplayIcon={app}\ico.ico
InfoBeforeFile=info.rtf
;Авторские права.
VersionInfoCopyright={#AuthRep}
;Производитель.
AppPublisher={#AuthRep}
RawDataResource=Botva:botva2.dll|b2p:b2p.dll|Logo:logo.png|bPic:bPic.png|LiPic:LiPic.png|aPic:aPic.p ng
AppCopyright={#AuthRep}
AppVerName={#MyAppVersion}
UninstallDisplayName={#MyAppName}
AppModifyPath={app}
VersionInfoVersion={#MyAppVersion}
VersionInfoTextVersion={#MyAppVersion}
VersionInfoProductName={#MyAppName}
VersionInfoProductVersion={#MyAppVersion}
DirExistsWarning=no
AppendDefaultDirName=no
AppendDefaultGroupName=no
LicenseFile=license.txt
DisableReadyPage=yes
AppId=TheBestAidaInstallEver

[Languages]
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"

[Components]
Name: AIDA641; Description: {#AIDA641}; Flags: exclusive;
Name: AIDA642; Description: {#AIDA642}; Flags: exclusive;

[Tasks]
Name: icons; Description: Создать Ярлыки:;
Name: icons\desktop; Description: На Рабочем Столе;
Name: icons\quicklaunchicon; Description: В Панели Задач; OnlyBelowVersion: 0,6.1;

[Files]
;Файлы распаковываемые в папку с игрой. Необходимы для деинсталлятора;
Source: WinTB.dll; Flags: dontcopy;
Source: info.rtf; DestDir: {app}; Flags: ignoreversion
Source: license.txt; DestDir: {app}; Flags: ignoreversion
Source: ico.ico; DestDir: {app}; Flags: ignoreversion
Source: 1.ico; DestDir: {app}; Flags: ignoreversion
Source: 2.ico; DestDir: {app}; Flags: ignoreversion
Source: {app}\{#AIDA641}\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs; Components: AIDA641;
Source: {app}\{#AIDA642}\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs; Components: AIDA642;
; Примечание: Не используйте "Flags: ignoreversion" для системных файлов

[Icons]
Name: {group}\{#AIDA641}; Filename: {app}\{#AIDA64EXE1}; Components: AIDA641;
Name: {group}\{#AIDA642}; Filename: {app}\{#AIDA64EXE2}; Components: AIDA642;
Name: {group}\{cm:UninstallProgram,{#AIDA641}}; Filename: {uninstallexe}; Components: AIDA641; IconFilename: {app}\1.ico;
Name: {group}\{cm:UninstallProgram,{#AIDA642}}; Filename: {uninstallexe}; Components: AIDA642; IconFilename: {app}\2.ico;
Name: {group}\Сайт {#MyAppName}; Filename: {#MyAppURL}; Components: AIDA641;
Name: {group}\Сайт {#MyAppName}; Filename: {#MyAppURL}; Components: AIDA642;
Name: {group}\Справка {#AIDA641}; Filename: {app}\aida64.chm; Components: AIDA641;
Name: {group}\Справка {#AIDA642}; Filename: {app}\aida64.chm; Components: AIDA642;
Name: {commondesktop}\{#AIDA641}; Filename: {app}\{#AIDA64EXE1}; Tasks: icons\desktop; Components: AIDA641;
Name: {commondesktop}\{#AIDA642}; Filename: {app}\{#AIDA64EXE2}; Tasks: icons\desktop; Components: AIDA642;
Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\{#AIDA641}; Filename: {app}{#AIDA64EXE1}; Tasks: icons\quicklaunchicon; Components: AIDA641;
Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\{#AIDA642}; Filename: {app}{#AIDA64EXE2}; Tasks: icons\quicklaunchicon; Components: AIDA642;

[Run]
Filename: {app}\{#AIDA64EXE1}; Description: "{cm:LaunchProgram,{#StringChange(AIDA641, '&', '&&')}}"; Flags: nowait postinstall skipifsilent Unchecked; Components: AIDA641;
Filename: {app}\{#AIDA64EXE2}; Description: "{cm:LaunchProgram,{#StringChange(AIDA642, '&', '&&')}}"; Flags: nowait postinstall skipifsilent Unchecked; Components: AIDA642;

[Messages]
BeveledLabel=RePack by {#AuthRep}

[...Code]
#ifdef UNICODE
#define A "W"
#else
#define A "A"
#endif

const
RT_RCDATA = 10;
APPID_AIDA_EXTREME = 'AIDA64 Extreme Edition';
APPID_AIDA_BUISNES = 'AIDA64 Business Edition';

WAIT_OBJECT_0 = $0;
STARTF_USESHOWWINDOW = 1;
NORMAL_PRIORITY_CLASS = $00000020;
INFINITE = $FFFFFFFF;

type
_STARTUPINFO = record
cb: DWORD;
#ifdef UNICODE
lpReserved, lpDesktop, lpTitle: PAnsiChar;
#else
lpReserved, lpDesktop, lpTitle: PChar;
#endif
dwX, dwY, dwXSize, dwYSize, dwXCountChars, dwYCountChars, dwFillAttribute, dwFlags: DWORD;
wShowWindow, cbReserved2: Word;
lpReserved2: Byte;
hStdInput, hStdOutput, hStdError: THandle;
end;

_PROCESS_INFORMATION = record
hProcess: THandle;
hThread: THandle;
dwProcessId: DWORD;
dwThreadId: DWORD;
end;


function CloseHandle(hObject: THandle): BOOL; external 'CloseHandle@kernel32.dll stdcall';
function WaitForSingleObject(hHandle: THandle; dwMilliseconds: DWORD): DWORD; external 'WaitForSingleObject@kernel32.dll stdcall';
#ifdef UNICODE
function CreateProcess(lpApplicationName, lpCommandLine: PAnsiChar; lpProcessAttributes, lpThreadAttributes: Longint; bInheritHandles: BOOL; dwCreationFlags: DWORD; lpEnvironment, lpCurrentDirectory: PAnsiChar; const lpStartupInfo: _STARTUPINFO; var lpProcessInformation: _PROCESS_INFORMATION): BOOL; external 'CreateProcess{#A}@kernel32.dll stdcall';
#else
function CreateProcess(lpApplicationName, lpCommandLine: PChar; lpProcessAttributes, lpThreadAttributes: Longint; bInheritHandles: BOOL; dwCreationFlags: DWORD; lpEnvironment, lpCurrentDirectory: PChar; const lpStartupInfo: _STARTUPINFO; var lpProcessInformation: _PROCESS_INFORMATION): BOOL; external 'CreateProcess{#A}@kernel32.dll stdcall';
#endif

var
TDV: TFolderTreeView;
TFV: TStartMenuFolderTreeView;
ResultCode: Integer;
lPLogo, bPicHandle, bPicHandle2, lPicHandle: THandle;
BtnImage: TBitmapImage;
CheckLicense: TCheckBox;
iInitialize: Boolean;


function GetUninstallPath(const AppIds: array of String): array of String;
var
StringList: TStringList;
i, Len: Integer;
Buff: String;
begin
for i := 0 to GetArrayLength(AppIds)-1 do
begin
Buff := RemoveQuotes(ExpandConstant('{reg:HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + AppIds[i] + '_is1,UninstallString|}'));
if Buff <> '' then
begin
Len := GetArrayLength(Result);
SetArrayLength(Result, Len+1);
Result[Len] := Buff;
end;
end;
end;


procedure UninstallApps(const UninstallPathes: array of String);
var
pi: _PROCESS_INFORMATION;
si: _STARTUPINFO;
i: Integer;
begin
for i := 0 to GetArrayLength(UninstallPathes)-1 do
begin
si.cb := SizeOf(si);
si.dwFlags := STARTF_USESHOWWINDOW;
si.wShowWindow := SW_SHOWNORMAL;
#ifdef UNICODE
if not CreateProcess('', PAnsiChar(UninstallPathes[i]), 0, 0, False, NORMAL_PRIORITY_CLASS, '', '', si, pi) then
#else
if not CreateProcess('', PChar(UninstallPathes[i]), 0, 0, False, NORMAL_PRIORITY_CLASS, '', '', si, pi) then
#endif
begin
MsgBox(SysErrorMessage(DLLGetLastError), mbCriticalError, MB_OK);
Exit;
end;
try
while WaitForSingleObject(pi.hProcess, INFINITE) <> WAIT_OBJECT_0 do Application.ProcessMessages;
finally
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
end;
end;
end;

function GetFromRes(const ResName, SaveFileName: String): Boolean;
var
lResStream: TResourceStream;
begin
lResStream := TResourceStream.Create(HInstance, ResName, RT_RCDATA);
try
lResStream.SaveToFile(AddBackslash(ExpandConstant('{tmp}')) + SaveFileName);
finally
lResStream.Free;
Result := FileExists(AddBackslash(ExpandConstant('{tmp}')) + SaveFileName);
end;
end;

function InitializeSetup:boolean;
var
i, Len: Integer;
uArray: array of String;
begin
uArray := GetUninstallPath( ['{#SetupSetting("AppID")}', APPID_AIDA_EXTREME, APPID_AIDA_BUISNES] );
Len := GetArrayLength(uArray);
Result := Len = 0;
if not Result then if MsgBox('Перед установкой необходимо удалить все старые версии приложения, вызвать программы удаления сейчас?', mbError, MB_YESNO) = IDYES then
begin
UninstallApps(uArray);
Result := InitializeSetup();
end;
end;

procedure LicenseOnClick(Sender: TObject);
begin
case TCheckBox(Sender).Checked of
True: WizardForm.LicenseAcceptedRadio.Checked := True;
False: WizardForm.LicenseNotAcceptedRadio.Checked := True;
end;
end;

procedure TDVOnChange(Sender: TObject);
begin
if IsComponentSelected('AIDA641') then
WizardForm.DirEdit.Text:= AddBackslash(TDV.Directory)+''
else
if IsComponentSelected('AIDA642') then
WizardForm.DirEdit.Text:= AddBackslash(TDV.Directory)+'';
end;

procedure TFVOnChange(Sender: TObject);
begin
if IsComponentSelected('AIDA641') then
WizardForm.GroupEdit.Text:= AddBackslash(TFV.Directory)+''
else
if IsComponentSelected('AIDA642') then
WizardForm.GroupEdit.Text:= AddBackslash(TFV.Directory)+'';
end;

function OnShouldSkipPage(Sender: TWizardPage): Boolean;
begin
if WizardForm.ComponentsList.Items.Count > 0 then WizardForm.Tag:= 1; // отображаются страницы выбора папки и компонентов
end;

procedure RedesignWizardForm;
begin
with WizardForm.ComponentsList do
begin
Top := ScaleY(50);
Height := ScaleY(155);
end;
end;

procedure InitializeWizard;
begin
RedesignWizardForm;
WizardForm.TypesCombo.hide;
PageFromID(wpSelectDir).OnShouldSkipPage:= @OnShouldSkipPage;
WizardForm.LicenseNotAcceptedRadio.Hide;
WizardForm.LicenseAcceptedRadio.Hide;
WizardForm.LicenseMemo.Height := ScaleY(175);

CheckLicense:= TCheckBox.Create(WizardForm);
CheckLicense.Left:= ScaleX(0);
CheckLicense.Top:= ScaleY(216);
CheckLicense.Caption:= WizardForm.LicenseAcceptedRadio.Caption;
CheckLicense.Width:= ScaleX(417);
CheckLicense.OnClick:= @LicenseOnClick;
CheckLicense.Parent:= WizardForm.LicensePage;
with WizardForm do
begin
iInitialize := True;
if GetFromRes('_IS_BOTVA', 'botva2.dll') and GetFromRes('_IS_B2P', 'b2p.dll') and GetFromRes('_IS_LOGO', 'logo.png') and GetFromRes('_IS_BPIC', 'bPic.png') and GetFromRes('_IS_LIPIC', 'LiPic.png') and GetFromRes('_IS_APIC', 'aPic.png') then
begin
bPicHandle := ImgLoad(WelcomePage.Handle, ExpandConstant('{tmp}\aPic.png'), WizardBitmapImage.Left, WizardBitmapImage.Top, WizardBitmapImage.Width, WizardBitmapImage.Height, True, True);
WizardBitmapImage.Hide;
ImgSetVisibility(bPicHandle, True);
ImgApplyChanges(WelcomePage.Handle);

bPicHandle := ImgLoad(FinishedPage.Handle, ExpandConstant('{tmp}\bPic.png'), WizardBitmapImage2.Left, WizardBitmapImage2.Top, WizardBitmapImage2.Width, WizardBitmapImage2.Height, True, True);
WizardBitmapImage2.Hide;
ImgSetVisibility(bPicHandle, True);
ImgApplyChanges(FinishedPage.Handle);

lPicHandle := ImgLoad(MainPanel.Handle, ExpandConstant('{tmp}\LiPic.png'), WizardSmallBitmapImage.Left, WizardSmallBitmapImage.Top, WizardSmallBitmapImage.Width, WizardSmallBitmapImage.Height, True, True);
WizardSmallBitmapImage.Hide;
ImgSetVisibility(lPicHandle, True);
ImgApplyChanges(MainPanel.Handle);

lPLogo:= ImgLoad(WizardForm.Handle, ExpandConstant('{tmp}\logo.png'), ScaleX(20), ScaleY(320), ScaleX(126), ScaleY(38), True, True);
ImgApplyChanges(WizardForm.Handle);
end;

ExtractTemporaryFile('WinTB.dll');
SetTaskBarProgressValue(0, 60);
SetTaskBarProgressState(0, TBPF_ERROR);
TaskBarV10(MainForm.Handle, WizardForm.Handle, false, false, 0, 0, _m_);

TDV:= TFolderTreeView.Create(WizardForm);
TDV.Top:= WizardForm.DirEdit.Top+28;
TDV.Width:= 417;
TDV.Height:= 100;
TDV.OnChange:= @TDVOnChange;
TDV.Parent:= WizardForm.SelectDirPage;

TFV:= TStartMenuFolderTreeView.Create(nil);
TFV.Top:= WizardForm.GroupEdit.Top+28;
TFV.Width:= 417;
TFV.Height:= 100;
TFV.SetPaths(ExpandConstant('{userprograms}'),ExpandConstant('{commonprograms}'),ExpandConstant('{us erstartup}'),ExpandConstant('{commonstartup}'));
TFV.OnChange:= @TFVOnChange;
TFV.Parent:= WizardForm.SelectProgramGroupPage;

with TLabel.Create(WizardForm) do
begin
Parent:=WizardForm;
AutoSize:=False;
Transparent:= true;
SetBounds(ScaleX(20), ScaleY(320), ScaleX(126), ScaleY(38));
end;
end;
end;

Procedure CurPageChanged(CurPageID: Integer);
Begin
Case CurPageID of
wpSelectDir: if WizardForm.Tag = 1 then
begin
WizardForm.SelectDirPage.Notebook.ActivePage:= WizardForm.SelectComponentsPage;
WizardForm.PageNameLabel.Caption:= SetupMessage(msgWizardSelectComponents);
WizardForm.Hint:= WizardForm.PageDescriptionLabel.Caption; // запомнить SetupMessage(msgSelectDirDesc)
WizardForm.PageDescriptionLabel.Caption:= SetupMessage(msgSelectComponentsDesc);
end;
wpSelectComponents: if WizardForm.Tag = 1 then
begin
WizardForm.SelectComponentsPage.Notebook.ActivePage:= WizardForm.SelectDirPage;
WizardForm.DiskSpaceLabel.Caption:= WizardForm.ComponentsDiskSpaceLabel.Caption;
WizardForm.PageNameLabel.Caption:= SetupMessage(msgWizardSelectDir);
WizardForm.PageDescriptionLabel.Caption:= WizardForm.Hint; // иначе вместо названия программы [name]
if IsComponentSelected('AIDA641') then
begin
WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{#SetupSetting("DefaultDirName")}')) + '{#AIDA641}';
WizardForm.GroupEdit.Text := AddBackslash(ExpandConstant('{#SetupSetting("DefaultGroupName")}')) + '{#AIDA641}';
end else
if IsComponentSelected('AIDA642') then
begin
WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{#SetupSetting("DefaultDirName")}')) + '{#AIDA642}'
WizardForm.GroupEdit.Text := AddBackslash(ExpandConstant('{#SetupSetting("DefaultGroupName")}')) + '{#AIDA642}'
end;
end;
wpSelectTasks:
begin
WizardForm.NextButton.Caption:= SetupMessage(msgButtonInstall);
end;
end;
end;

procedure DeinitializeSetup();
begin
if iInitialize then
begin
gdipShutdown;
TaskBarDestroy;
end;
end;

procedure InitializeUninstallProgressForm;
begin
with UninstallProgressForm do
begin
if GetFromRes('_IS_BOTVA', 'botva2.dll') and GetFromRes('_IS_B2P', 'b2p.dll') and GetFromRes('_IS_LOGO', 'logo.png') and GetFromRes('_IS_LIPIC', 'LIPic.png') then
begin
lPicHandle := ImgLoad(MainPanel.Handle, ExpandConstant('{tmp}\LiPic.png'), WizardSmallBitmapImage.Left, WizardSmallBitmapImage.Top, WizardSmallBitmapImage.Width, WizardSmallBitmapImage.Height, True, True);
WizardSmallBitmapImage.Hide;
ImgSetVisibility(lPicHandle, True);
ImgApplyChanges(MainPanel.Handle);

lPLogo:= ImgLoad(UninstallProgressForm.Handle, ExpandConstant('{tmp}\logo.png'), ScaleX(20), ScaleY(320), ScaleX(126), ScaleY(38), True, True);
ImgApplyChanges(UninstallProgressForm.Handle);
end;

with TLabel.Create(nil) do
begin
Parent:=UninstallProgressForm;
AutoSize:=False;
Transparent:= true;
SetBounds(ScaleX(20), ScaleY(320), ScaleX(126), ScaleY(38));
end;
end;
end;

procedure DeinitializeUninstall();
begin
gdipShutdown;
end;

saurn
13-04-2013, 19:12
habib2302, А взять по отдельности примеры из которых скрипт собрали, не?

Поменять страницы местами (http://forum.oszone.net/post-2100306-1737.html)
wizardimage и wazardsmallimage без фона (http://forum.oszone.net/post-2124480-57.html)
Лого без фона (http://forum.oszone.net/post-2121075-7.html)
Удаление других версий приложения при старте (http://forum.oszone.net/post-2129403-141.html)
Чекбокс лицензионного соглашения (http://forum.oszone.net/post-2122278-28.html)
Изменение пути установки в зависимости от выбранного компонента (http://forum.oszone.net/post-2128094-115.html)




© OSzone.net 2001-2012