доброе время суток. дело в том, что последний код который давал Tapas77789 и он работает, но когда стоит компонент CDI\instal я не могу убрать галочки с компонентов для создания ярлыков.
[more=скрипт]; Скрипт создан через Мастер Inno Setup Script.
; ИСПОЛЬЗУЙТЕ ДОКУМЕНТАЦИЮ ДЛЯ ПОДРОБНОСТЕЙ ИСПОЛЬЗОВАНИЯ INNO SETUP!
#define MyAppName "CrystalDiskInfo"
#define MyAppVersion "6.0.4"
#define MyAppPublisher "Copyright © 2008-2013 hiyohiyo. All rights reserved."
#define MyAppURL "http://crystalmark.info/"
#define MyAppExeName "DiskInfo.exe"
#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}\CrystalDiskInfo
DefaultGroupName=CrystalDiskInfo
AllowNoIcons=true
OutputBaseFilename={#MyAppName} {#MyAppVersion} RePack (& Portable) by Xabib
SetupIconFile=ico.ico
Compression=lzma/Ultra64
SolidCompression=true
InternalCompressLevel=Ultra64
DiskSpanning=false
DiskSliceSize=736000000
ShowLanguageDialog=yes
SlicesPerDisk=4
UninstallDisplayIcon={app}\ico.ico
;Производитель.
AppPublisher={#MyAppPublisher}
RawDataResource=Botva:botva2.dll|b2p:b2p.dll|Logo:logo.png|bPic:bPic.png|LiPic:LiPic.png|aPic:aPic.png
AppModifyPath={app}
VersionInfoProductName={#MyAppName}
DirExistsWarning=no
AppendDefaultDirName=false
AppendDefaultGroupName=false
DisableReadyPage=true
AppID=CrystalDiskInfo
VersionInfoDescription={#MyAppName} RePack by Xabib
AppCopyright=Xabib © 2013
VersionInfoVersion={#MyAppVersion}
VersionInfoProductVersion={#MyAppVersion}
VersionInfoCopyright=Xabib © 2013
DisableFinishedPage=false
UninstallDisplayName={#MyAppName}
ComponentsListTVStyle=true
ShowComponentSizes=false
Uninstallable=not IsComponentSelected('CDI\Portable')
[Languages]
Name: "Russian"; MessagesFile: "Russian.isl"
[CustomMessages]
Russian.Msg1=Перед установкой необходимо удалить предыдущую версию приложения. Продолжить?
Russian.MsgErorr=Удаление завершилось неудачей!
[Types]
Name: full; Description: Полная установка; Flags: iscustom
[Components]
Name: CDI; Description: {#MyAppName}; Flags: fixed; Types: full;
Name: CDI\instal; Description: Установить {#MyAppName}; Flags: exclusive
Name: CDI\Portable; Description: Распаковать {#MyAppName}; Flags: exclusive
Name: icons; Description: {cm:AdditionalIcons}; Types: full;
Name: icons\desktop; Description: {cm:CreateDesktopIcon}; Types: full;
Name: icons\quicklaunchicon; Description: {cm:CreateQuickLaunchIcon}; OnlyBelowVersion: 0,6.1; Types: full;
Name: icons\quicklaunchicon7; Description: {cm:CreateQuickLaunchIcon}; MinVersion: 0,6.1; Types: full;
Name: InterfaceLang; Description: {cm:InterfaceLang}; Flags: fixed; Types: full;
Name: InterfaceLang\ru; Description: Русский; Flags: exclusive;
Name: InterfaceLang\en; Description: Английский; Flags: exclusive;
Name: InterfaceLang\ua; Description: Украинский; Flags: exclusive;
[Files]
;Файлы распаковываемые в папку с игрой. Необходимы для деинсталлятора;
Source: WinTB.dll; Flags: dontcopy;
Source: ico.ico; DestDir: {app}; Flags: ignoreversion
Source: PinToTasckbar.vbs; DestDir: {tmp}; Flags: deleteafterinstall; Components: CDI\instal;
; Примечание: Не используйте "Flags: ignoreversion" для системных файлов
Source: {app}\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs; Components: "CDI\instal CDI\Portable";
[Icons]
Name: {group}\{#MyAppName}; Filename: {app}\{#MyAppExeName}; Components: CDI\instal;
Name: {group}\{cm:UninstallProgram,{#MyAppName}}; Filename: {uninstallexe}; Components: CDI\instal;
Name: {group}\{cm:ProgramOnTheWeb,{#MyAppName}}; Filename: {#MyAppURL}; Components: CDI\instal;
Name: {commondesktop}\{#MyAppName}; Filename: {app}\{#MyAppExeName}; Components: CDI\instal;
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: {app}\{#MyAppExeName}; Components: CDI\instal;
[Run]
Filename: {app}\{#MyAppExeName}; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait skipifsilent PostInstall;
Filename: {tmp}\PinToTasckbar.vbs; Parameters: """{app}\{#MyAppExeName}"""; Flags: shellexec; Components: CDI\instal;
[Code]
#ifdef UNICODE
#define A "W"
#else
#define A "A"
#endif
const
///////////////////////////////////Относится к лого и изображениям мастера
RT_RCDATA = 10;
function UninstallMyApp(): Boolean;
var
Buff: String;
i: Integer;
begin
Result := not RegQueryStringValue( HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#SetupSetting("AppID")}_is1', 'UninstallString', Buff );
if not Result then Result := not FileExists(RemoveQuotes(Buff));
if not Result then if MsgBox(CustomMessage('Msg1'), mbError, MB_YESNO) = IDYES then
try
Exec(RemoveQuotes(Buff), '', ExtractFilePath(RemoveQuotes(Buff)), SW_SHOW, ewWaitUntilTerminated, i);
finally
Result := not RegQueryStringValue( HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#SetupSetting("AppID")}_is1', 'UninstallString', Buff );
if not Result then MsgBox(CustomMessage('MsgErorr'), mbError, MB_OK);
end;
end;
var
///////////////////////////////////Лого и изображения
lPLogo, bPicHandle, bPicHandle2, lPicHandle: THandle;
BtnImage: TBitmapImage;
///////////////////////////////////////////
CheckLicense: TCheckBox;
iInitialize: Boolean;
TDV: TFolderTreeView;
TFV: TStartMenuFolderTreeView;
///////////////////////////////////Ресурсы(относится к лого и изображениям мастера)
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;
procedure TDVOnChange(Sender: TObject);
begin
if IsComponentSelected('CDI\instal') then
WizardForm.DirEdit.Text:= AddBackslash(TDV.Directory)+'{#MyAppName}';
if IsComponentSelected('CDI\Portable') then
WizardForm.DirEdit.Text:= AddBackslash(TDV.Directory)+'{#MyAppName} Portable';
end;
////////////////////////////////
///////////////////////////////////Дерево выбора папки программ
procedure TFVOnChange(Sender: TObject);
begin
if IsComponentSelected('CDI\instal') then
WizardForm.GroupEdit.Text:= AddBackslash(TFV.Directory)+'{#MyAppName}';
if IsComponentSelected('CDI\Portable') then
WizardForm.GroupEdit.Text:= AddBackslash(TFV.Directory)+'{#MyAppName} Portable';
end;
function OnShouldSkipPage(Sender: TWizardPage): Boolean;
begin
if WizardForm.ComponentsList.Items.Count > 0 then WizardForm.Tag:= 1; // отображаются страницы выбора папки и компонентов
end;
function InitializeSetup:boolean;
begin
Result := UninstallMyApp();
end;
procedure CompNotEnabled(const CompName, InString: String);
var i:integer;
begin
with WizardForm.ComponentsList do
begin
for i:=1 to Items.Count-1 do
begin
if ItemCaption[i]=InString then break;
end;
Checked[i]:=not IsComponentSelected(CompName);
ItemEnabled[i]:=not IsComponentSelected(CompName);
end;
end;
procedure CompOnCheckClick(Sender: TObject);
begin
CompNotEnabled(ExpandConstant('CDI\Portable'),ExpandConstant('{cm:AdditionalIcons}'));
CompNotEnabled(ExpandConstant('CDI\Portable'),ExpandConstant('{cm:CreateDesktopIcon}'));
CompNotEnabled(ExpandConstant('CDI\Portable'),ExpandConstant('{cm:CreateQuickLaunchIcon}'));
end;
procedure InitializeWizard;
begin
WizardForm.ComponentsList.OnClickCheck:=@CompOnCheckClick;
PageFromID(wpSelectDir).OnShouldSkipPage:= @OnShouldSkipPage
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(318), ScaleX(124), ScaleY(40), True, True);
ImgApplyChanges(WizardForm.Handle);
end;
///////////////////////////////////WinTB
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('{userstartup}'),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(318), ScaleX(124), ScaleY(40));
end;
end;
end;
Procedure CurPageChanged(CurPageID: Integer);
Begin
Case CurPageID of
wpSelectProgramGroup:
begin
WizardForm.NoIconsCheck.Checked:=IsComponentSelected('CDI\Portable');
WizardForm.NoIconsCheck.Enabled:=not IsComponentSelected('CDI\Portable');
WizardForm.NextButton.Caption:= SetupMessage(msgButtonInstall);
end;
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('CDI\Portable') then
begin
WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{src}')) + '{#MyAppName} Portable'
WizardForm.GroupEdit.Text := (ExpandConstant('{#SetupSetting("DefaultGroupName")} Portable'))
end
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(318), ScaleX(124), ScaleY(40), True, True);
ImgApplyChanges(UninstallProgressForm.Handle);
end;
with TLabel.Create(nil) do
begin
Parent:=UninstallProgressForm;
AutoSize:=False;
Transparent:= true;
SetBounds(ScaleX(20), ScaleY(318), ScaleX(124), ScaleY(40));
end;
end;
end;
procedure DeinitializeUninstall();
begin
gdipShutdown;
end;
[Ini]
filename: {app}\DiskInfo.ini; Section: Setting; Key: Language; String: Russian; Components: InterfaceLang\ru;
filename: {app}\DiskInfo.ini; Section: Setting; Key: Language; string: English; Components: InterfaceLang\en;
filename: {app}\DiskInfo.ini; Section: Setting; Key: Language; string: Ukrainian; Components: InterfaceLang\ua;
[/more]
тест инсталлятор
[more=скрипт]; Скрипт создан через Мастер Inno Setup Script.
; ИСПОЛЬЗУЙТЕ ДОКУМЕНТАЦИЮ ДЛЯ ПОДРОБНОСТЕЙ ИСПОЛЬЗОВАНИЯ INNO SETUP!
#define MyAppName "CrystalDiskInfo"
#define MyAppVersion "6.0.4"
#define MyAppPublisher "Copyright © 2008-2013 hiyohiyo. All rights reserved."
#define MyAppURL "http://crystalmark.info/"
#define MyAppExeName "DiskInfo.exe"
#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}\CrystalDiskInfo
DefaultGroupName=CrystalDiskInfo
AllowNoIcons=true
OutputBaseFilename={#MyAppName} {#MyAppVersion} RePack (& Portable) by Xabib
SetupIconFile=ico.ico
Compression=lzma/Ultra64
SolidCompression=true
InternalCompressLevel=Ultra64
DiskSpanning=false
DiskSliceSize=736000000
ShowLanguageDialog=yes
SlicesPerDisk=4
UninstallDisplayIcon={app}\ico.ico
;Производитель.
AppPublisher={#MyAppPublisher}
RawDataResource=Botva:botva2.dll|b2p:b2p.dll|Logo:logo.png|bPic:bPic.png|LiPic:LiPic.png|aPic:aPic.png
AppModifyPath={app}
VersionInfoProductName={#MyAppName}
DirExistsWarning=no
AppendDefaultDirName=false
AppendDefaultGroupName=false
DisableReadyPage=true
AppID=CrystalDiskInfo
VersionInfoDescription={#MyAppName} RePack by Xabib
AppCopyright=Xabib © 2013
VersionInfoVersion={#MyAppVersion}
VersionInfoProductVersion={#MyAppVersion}
VersionInfoCopyright=Xabib © 2013
DisableFinishedPage=false
UninstallDisplayName={#MyAppName}
ComponentsListTVStyle=true
ShowComponentSizes=false
Uninstallable=not IsComponentSelected('CDI\Portable')
[Languages]
Name: "Russian"; MessagesFile: "Russian.isl"
[CustomMessages]
Russian.Msg1=Перед установкой необходимо удалить предыдущую версию приложения. Продолжить?
Russian.MsgErorr=Удаление завершилось неудачей!
[Types]
Name: full; Description: Полная установка; Flags: iscustom
[Components]
Name: CDI; Description: {#MyAppName}; Flags: fixed; Types: full;
Name: CDI\instal; Description: Установить {#MyAppName}; Flags: exclusive
Name: CDI\Portable; Description: Распаковать {#MyAppName}; Flags: exclusive
Name: icons; Description: {cm:AdditionalIcons}; Types: full;
Name: icons\desktop; Description: {cm:CreateDesktopIcon}; Types: full;
Name: icons\quicklaunchicon; Description: {cm:CreateQuickLaunchIcon}; OnlyBelowVersion: 0,6.1; Types: full;
Name: icons\quicklaunchicon7; Description: {cm:CreateQuickLaunchIcon}; MinVersion: 0,6.1; Types: full;
Name: InterfaceLang; Description: {cm:InterfaceLang}; Flags: fixed; Types: full;
Name: InterfaceLang\ru; Description: Русский; Flags: exclusive;
Name: InterfaceLang\en; Description: Английский; Flags: exclusive;
Name: InterfaceLang\ua; Description: Украинский; Flags: exclusive;
[Files]
;Файлы распаковываемые в папку с игрой. Необходимы для деинсталлятора;
Source: WinTB.dll; Flags: dontcopy;
Source: ico.ico; DestDir: {app}; Flags: ignoreversion
Source: PinToTasckbar.vbs; DestDir: {tmp}; Flags: deleteafterinstall; Components: CDI\instal;
; Примечание: Не используйте "Flags: ignoreversion" для системных файлов
Source: {app}\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs; Components: "CDI\instal CDI\Portable";
[Icons]
Name: {group}\{#MyAppName}; Filename: {app}\{#MyAppExeName}; Components: CDI\instal;
Name: {group}\{cm:UninstallProgram,{#MyAppName}}; Filename: {uninstallexe}; Components: CDI\instal;
Name: {group}\{cm:ProgramOnTheWeb,{#MyAppName}}; Filename: {#MyAppURL}; Components: CDI\instal;
Name: {commondesktop}\{#MyAppName}; Filename: {app}\{#MyAppExeName}; Components: CDI\instal;
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: {app}\{#MyAppExeName}; Components: CDI\instal;
[Run]
Filename: {app}\{#MyAppExeName}; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait skipifsilent PostInstall;
Filename: {tmp}\PinToTasckbar.vbs; Parameters: """{app}\{#MyAppExeName}"""; Flags: shellexec; Components: CDI\instal;
[Code]
#ifdef UNICODE
#define A "W"
#else
#define A "A"
#endif
const
///////////////////////////////////Относится к лого и изображениям мастера
RT_RCDATA = 10;
function UninstallMyApp(): Boolean;
var
Buff: String;
i: Integer;
begin
Result := not RegQueryStringValue( HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#SetupSetting("AppID")}_is1', 'UninstallString', Buff );
if not Result then Result := not FileExists(RemoveQuotes(Buff));
if not Result then if MsgBox(CustomMessage('Msg1'), mbError, MB_YESNO) = IDYES then
try
Exec(RemoveQuotes(Buff), '', ExtractFilePath(RemoveQuotes(Buff)), SW_SHOW, ewWaitUntilTerminated, i);
finally
Result := not RegQueryStringValue( HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#SetupSetting("AppID")}_is1', 'UninstallString', Buff );
if not Result then MsgBox(CustomMessage('MsgErorr'), mbError, MB_OK);
end;
end;
var
///////////////////////////////////Лого и изображения
lPLogo, bPicHandle, bPicHandle2, lPicHandle: THandle;
BtnImage: TBitmapImage;
///////////////////////////////////////////
CheckLicense: TCheckBox;
iInitialize: Boolean;
TDV: TFolderTreeView;
TFV: TStartMenuFolderTreeView;
///////////////////////////////////Ресурсы(относится к лого и изображениям мастера)
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;
procedure TDVOnChange(Sender: TObject);
begin
if IsComponentSelected('CDI\instal') then
WizardForm.DirEdit.Text:= AddBackslash(TDV.Directory)+'{#MyAppName}';
if IsComponentSelected('CDI\Portable') then
WizardForm.DirEdit.Text:= AddBackslash(TDV.Directory)+'{#MyAppName} Portable';
end;
////////////////////////////////
///////////////////////////////////Дерево выбора папки программ
procedure TFVOnChange(Sender: TObject);
begin
if IsComponentSelected('CDI\instal') then
WizardForm.GroupEdit.Text:= AddBackslash(TFV.Directory)+'{#MyAppName}';
if IsComponentSelected('CDI\Portable') then
WizardForm.GroupEdit.Text:= AddBackslash(TFV.Directory)+'{#MyAppName} Portable';
end;
function OnShouldSkipPage(Sender: TWizardPage): Boolean;
begin
if WizardForm.ComponentsList.Items.Count > 0 then WizardForm.Tag:= 1; // отображаются страницы выбора папки и компонентов
end;
function InitializeSetup:boolean;
begin
Result := UninstallMyApp();
end;
procedure CompNotEnabled(const CompName, InString: String);
var i:integer;
begin
with WizardForm.ComponentsList do
begin
for i:=1 to Items.Count-1 do
begin
if ItemCaption[i]=InString then break;
end;
Checked[i]:=not IsComponentSelected(CompName);
ItemEnabled[i]:=not IsComponentSelected(CompName);
end;
end;
procedure CompOnCheckClick(Sender: TObject);
begin
CompNotEnabled(ExpandConstant('CDI\Portable'),ExpandConstant('{cm:AdditionalIcons}'));
CompNotEnabled(ExpandConstant('CDI\Portable'),ExpandConstant('{cm:CreateDesktopIcon}'));
CompNotEnabled(ExpandConstant('CDI\Portable'),ExpandConstant('{cm:CreateQuickLaunchIcon}'));
end;
procedure InitializeWizard;
begin
WizardForm.ComponentsList.OnClickCheck:=@CompOnCheckClick;
PageFromID(wpSelectDir).OnShouldSkipPage:= @OnShouldSkipPage
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(318), ScaleX(124), ScaleY(40), True, True);
ImgApplyChanges(WizardForm.Handle);
end;
///////////////////////////////////WinTB
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('{userstartup}'),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(318), ScaleX(124), ScaleY(40));
end;
end;
end;
Procedure CurPageChanged(CurPageID: Integer);
Begin
Case CurPageID of
wpSelectProgramGroup:
begin
WizardForm.NoIconsCheck.Checked:=IsComponentSelected('CDI\Portable');
WizardForm.NoIconsCheck.Enabled:=not IsComponentSelected('CDI\Portable');
WizardForm.NextButton.Caption:= SetupMessage(msgButtonInstall);
end;
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('CDI\Portable') then
begin
WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{src}')) + '{#MyAppName} Portable'
WizardForm.GroupEdit.Text := (ExpandConstant('{#SetupSetting("DefaultGroupName")} Portable'))
end
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(318), ScaleX(124), ScaleY(40), True, True);
ImgApplyChanges(UninstallProgressForm.Handle);
end;
with TLabel.Create(nil) do
begin
Parent:=UninstallProgressForm;
AutoSize:=False;
Transparent:= true;
SetBounds(ScaleX(20), ScaleY(318), ScaleX(124), ScaleY(40));
end;
end;
end;
procedure DeinitializeUninstall();
begin
gdipShutdown;
end;
[Ini]
filename: {app}\DiskInfo.ini; Section: Setting; Key: Language; String: Russian; Components: InterfaceLang\ru;
filename: {app}\DiskInfo.ini; Section: Setting; Key: Language; string: English; Components: InterfaceLang\en;
filename: {app}\DiskInfo.ini; Section: Setting; Key: Language; string: Ukrainian; Components: InterfaceLang\ua;
[/more]
тест инсталлятор