Войти

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


Страниц : 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

Devils Night
05-04-2012, 19:18
Raf-9600, К дереву компонентов которое хочешь скрыть добавляешь ; Flags: collapsed.

[Components]
Name: a; Description: Дерево; Types: full; Flags: collapsed
Name: a\1; Description: Компонент 1
Name: a\2; Description: Компонент 2
Name: a\2; Description: Компонент 3
Name: a\2; Description: Компонент 4

Johny777
05-04-2012, 19:26
Raf-9600, Devils Night,
вот из примера
Example_NewCheckListBox.iss

1: CheckListBox.TreeViewStyle := CheckListBox2.Checked[1];
это демо
те при нажатии на чекбокс появится возможность складывать дерево в купе с флагом collapsed
(кажется...)

Raf-9600
05-04-2012, 19:38
К дереву компонентов которое хочешь скрыть добавляешь ; Flags: collapsed. »
Но тогда оно будет постоянно свернуто, а мне нужно, чтобы оно сворачивалось, только если выбран определённый компонент.

Допустим чтобы древо относящееся к Game1 автоматически сворачивалось только если выбран Game2. А Game2 автоматически сворачивался только если выбран Game1.
[Components]
Name: "Game1"; Description: Игра 1; Flags: exclusive
Name: "Game1\One"; Description: Пункт 1;
Name: "Game1\Two"; Description: Пункт 2;
Name: "Game2"; Description: Игра 2; Flags: exclusive
Name: "Game2\One"; Description: Пункт 1;
Name: "Game2\Two"; Description: Пункт 2;

те при нажатии на чекбокс появится возможность складывать дерево в купе с флагом collapsed
(кажется...) »
А можно чтобы зависимость была не от чекбокса, а от определённого компонента? И чтобы не просто появлялась возможность свернуть, а чтобы автоматически сворачивалось (только)одно древо компонентов?

Johny777
05-04-2012, 20:08
Raf-9600,
ты знаешь
кажется настройка "TreeView" относится ко всему ListBox-у со всеми вытекающими последствиями
поэтому одна из 2-х игр будет только на одном листбоксе, созданном в коде.
От стандартного выбора типа установки придётся отказаться. Да думается мне и не нужен он для двух игр,
из которых за раз установить можно только одну!
потом попробую что-то придумать ), но совсем не уверен, что в итоге получится то, что нужно

Raf-9600
05-04-2012, 20:30
Johny777, благодарю за желание помочь мне, но если это сложно, то я бы не хотел никого напрягать своей просьбой.

Johny777
06-04-2012, 03:55
я бы не хотел никого напрягать своей просьбой. »
всё нормально! Появляется повод что-то сделать и при этом знания капают :)
по твоему вопросу ерунда получилась т.к. не знаю как сворачивать дерево
может кто другой додумает

[Setup]
AppName=My Program
AppVerName=My Program
DefaultDirName={pf}\My Program
DirExistsWarning=no
DisableProgramGroupPage=yes
DisableWelcomePage=yes
DisableDirPage=yes
DisableReadyPage=yes


[ Code]
var
ISCustomPage1: TWizardPage;
CheckListBox2: TNewCheckListBox;
CheckListBox1: TNewCheckListBox;

procedure make1(Sender: TObject);
begin
if CheckListBox1.Checked[0] = true then
begin
CheckListBox2.TreeViewStyle := true;
CheckListBox2.Checked[0] := false;
end
else
begin
CheckListBox2.TreeViewStyle := false;
CheckListBox2.Checked[0] := true;
end;
end;


procedure plus1(Sender: TObject);
begin
if CheckListBox2.Checked[0] = true then
begin
CheckListBox1.TreeViewStyle := true;
CheckListBox1.Checked[0] := false;
end
else
begin
CheckListBox1.TreeViewStyle := false;
CheckListBox1.Checked[0] := true;
end;
end;

procedure InitializeWizard();
begin
ISCustomPage1 := CreateCustomPage(wpWelcome, 'Test', 'Description');
WizardForm.Color := clWhite;
WizardForm.InnerPage.Color := clWhite;
ISCustomPage1.Surface.Color := clWhite;
WizardForm.NextButton.Hide;

CheckListBox2 := TNewCheckListBox.Create(WizardForm);
with CheckListBox2 do
begin
Name := 'CheckListBox2';
Parent := ISCustomPage1.Surface;
Left := ScaleX(0);
Top := ScaleY(100);
Width := ScaleX(417);
Height := ScaleY(100);
DragMode := dmAutomatic;
OnClickCheck := @plus1;
TreeViewStyle := True;
BorderStyle := bsNone;

AddCheckBoxEx('CheckBox_0', 'c01 00', 0, True, True, True, True, nil, True);
AddRadioButtonEx('RadioButton_1', 'r21 02', 1, True, True, nil, True);
AddRadioButtonEx('RadioButton_2', 'r22 03', 1, True, True, nil, True);
AddRadioButtonEx('RadioButton_3', 'r31 04', 1, True, True, nil, True);
AddRadioButtonEx('RadioButton_4', 'r32 05', 1, True, True, nil, True);
AddCheckBoxEx('CheckBox_4.1', 'c17 18', 2, True, True, False, True, nil, True);
end;


CheckListBox1 := TNewCheckListBox.Create(WizardForm);
with CheckListBox1 do
begin
Name := 'CheckListBox1';
Parent := ISCustomPage1.Surface;
Left := ScaleX(0);
Top := ScaleY(0);
Width := ScaleX(417);
Height := ScaleY(100);
OnClickCheck := @make1;
BorderStyle := bsNone;

AddCheckBoxEx('CheckBox_0', 'c01 00', 0, True, True, True, True, nil, True);
AddCheckBoxEx('CheckBox_0', 'c01 00', 1, True, True, True, True, nil, True);
AddCheckBoxEx('CheckBox_0', 'c01 00', 2, True, True, True, True, nil, True);
AddCheckBoxEx('CheckBox_0', 'c01 00', 2, True, True, True, True, nil, True);
AddCheckBoxEx('CheckBox_0', 'c01 00', 2, True, True, True, True, nil, True);
AddCheckBoxEx('CheckBox_4.1', 'c17 18', 2, True, True, False, True, nil, True);
end;
end;


procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
begin
Confirm := False;
end;

Raf-9600
06-04-2012, 09:06
по твоему вопросу ерунда получилась т.к. не знаю как сворачивать дерево »
Если честно, то я и предполагал что единственная возможная реализация будет такой, ибо вряд ли разрзрабы ResTools заморачивались относительно автоматического сворачивания компонентов :)

Ну да ладно, у меня другой вопрос: возможно ли менять описание компонентов в зависимости от того, какие выбраны?
Код на описание компонентов использую этот http://forum.oszone.net/post-1893249-1390.html

Пробовал писать примерно так:
if IsComponentSelected('Game1') = True then
AddDescription(1, 'Вариант 1');

if IsComponentSelected('Game2') = True then
AddDescription(1, 'Вариант 2');
Но все бестолку =(

Johny777
06-04-2012, 13:16
Raf-9600,
не совсем понимаю
в примере идёт описание сверху вниз в соответствии с элементами окошка компонентов (они тоже сверху вниз добавляются как в секции записано).

Raf-9600
06-04-2012, 13:23
Johny777, допустим есть такие компоненты:

[Components]
Name: "Game1"; Description: Игра 1; Flags: exclusive
Name: "Game2"; Description: Игра 2; Flags: exclusive
Name: "Item"; Description: Пункт;

Если выбрать Game1, то комментарий к Item должно быть одним, а если выбрать Game2 то комментарий к Item должен быть другим.

R.i.m.s.k.y.
06-04-2012, 13:25
Raf-9600, ща за 15-20 минут накидаю примерчик

[Components]
Name: "Game1"; Description: Игра 1; Flags: exclusive
Name: "Game2"; Description: Игра 2; Flags: exclusive
Name: "Item"; Description: Пункт;

[*Code]
var
game1, game2, Item : integer;
game1s, game2s, Items : string;

procedure CheckComponents;
begin
if IsComponentSelected('Game1') then begin
with WizardForm.ComponentsList do begin
ItemCaption[item] := items + 'Game1s';
end; end;//with WizardForm.ComponentsList do begin
if IsComponentSelected('Game2') then begin
with WizardForm.ComponentsList do begin
ItemCaption[item] := items + 'Game2s';
end; end;//with WizardForm.ComponentsList do begin
WizardForm.ComponentsList.Repaint;
end;

procedure ComponentOnClick(Sender: TObject);
begin
CheckComponents;
end;

procedure InitializeWizard()
begin
...
game1:= WizardForm.ComponentsList.Items.IndexOf('Игра 1'); game1s:= WizardForm.ComponentsList.ItemCaption[game1];
game2:= WizardForm.ComponentsList.Items.IndexOf('Игра 2'); game1s:= WizardForm.ComponentsList.ItemCaption[game2];
item:= WizardForm.ComponentsList.Items.IndexOf('Пункт'); items:= WizardForm.ComponentsList.ItemCaption[item];

WizardForm.ComponentsList.OnClick := @ComponentOnClick; CheckComponents;
...
end;

идеологически верно но могут быть пропущенные end'ы, кавыки, сам расставишь

щаз еще Лександр скажет "надо использовать case"
Да, н-н-надо, но я не знаю как перехватить номер нажатого компонента

Johny777
06-04-2012, 13:34
R.i.m.s.k.y.,
как привязать к элементу CheckListBox-а распаковку того или иного файла из секции Files?
можно пример?
CheckListBoх это тот же ComponentsList и TasksList,
http://img814.imageshack.us/img814/9562/11454349.png (http://imageshack.us/photo/my-images/814/11454349.png/)

R.i.m.s.k.y.
06-04-2012, 13:37
Johny777, а что такое CheckListBoх? с формами я никак
я серъезно не знаю

Johny777
06-04-2012, 13:47
R.i.m.s.k.y.,
в моём предыдущем сообщении (на предыдущей странице) 2 таких

Raf-9600
06-04-2012, 13:48
Инсталлятор выделяет эту строчку и говорит "Type mismatch"
ItemCaption[item] := items + 'Game1';

P.S.
На всякий случай уточняю: я имел ввиду не чтобы Description менялось, а чтобы комментарий к компоненту менялся. Ну, такой комментарий, который создаётся этим кодом http://forum.oszone.net/post-1893249-1390.html

R.i.m.s.k.y.
06-04-2012, 13:56
Johny777, не такое не знаю
Raf-9600, поправил выше сообщение, с комментариями тоже ыкстры

Raf-9600
06-04-2012, 14:27
поправил выше сообщение »
Не компилируется, продолжает жаловаться на ту же строчку =(

Johny777
06-04-2012, 14:42
Может пожалуйста кто-нибудь добавить сюда

[Setup]
AppName=My Program
AppVerName=My Program
DefaultDirName={pf}\My Program
DirExistsWarning=no
DisableProgramGroupPage=yes
DisableWelcomePage=yes
DisableDirPage=yes
DisableReadyPage=yes

[ Code]
{ RedesignWizardFormBegin } // Не удалять эту строку!
// Не изменять эту секцию. Она создана автоматически.
var
ISCustomPage1: TWizardPage;
ScrollBox1: TScrollBox;
BitmapImage1: TBitmapImage;

procedure RedesignWizardForm;
begin
{ Creates custom wizard page }
ISCustomPage1 := CreateCustomPage(wpWelcome, 'ISCustomPage1_Caption', 'ISCustomPage1_Description');

{ ISCustomPage1 }
with ISCustomPage1.Surface do
begin
Name := 'ISCustomPage1';
end;

{ ScrollBox1 }
ScrollBox1 := TScrollBox.Create(WizardForm);
with ScrollBox1 do
begin
Name := 'ScrollBox1';
Parent := ISCustomPage1.Surface;
Left := ScaleX(0);
Top := ScaleY(0);
Width := ScaleX(417);
Height := ScaleY(233);
end;

{ BitmapImage1 }
BitmapImage1 := TBitmapImage.Create(WizardForm);
with BitmapImage1 do
begin
Name := 'BitmapImage1';
Parent := ScrollBox1;
Left := ScaleX(6);
Top := ScaleY(6);
Width := ScaleX(345);
Height := ScaleY(9000);
end;

ScrollBox1.TabOrder := 0;

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

{ ReservationEnd }
end;
// Не изменять эту секцию. Она создана автоматически.
{ RedesignWizardFormEnd } // Не удалять эту строку!

procedure InitializeWizard();
begin
RedesignWizardForm;
end;




//прокручиваем вниз

procedure MouseWheelDown(Sender: TObject; Shift: TShiftState; MousePos: TPoint; var Handled: Boolean);
begin
Scrollbox1.VertScrollBar.Position:= Scrollbox1.VertScrollBar.Position+4;
end;

//прокручиваем вверх

procedure MouseWheelUp(Sender: TObject; Shift: TShiftState;
MousePos: TPoint; var Handled: Boolean);
begin
Scrollbox1.VertScrollBar.Position:= Scrollbox1.VertScrollBar.Position-4;
end;



[ISFormDesigner]
WizardForm=FF0A005457495A415244464F524D003010E702000054504630F10B5457697A617264466F726D0A57697A61726 4466F726D0C436C69656E744865696768740368010B436C69656E74576964746803F1010C4578706C696369744C656674020 00B4578706C69636974546F7002000D4578706C6963697457696474680301020E4578706C69636974486569676874038E010 D506978656C73506572496E636802600A54657874486569676874020D00F10C544E65774E6F7465626F6F6B0D4F757465724 E6F7465626F6F6B00F110544E65774E6F7465626F6F6B506167650B57656C636F6D6550616765084E65787450616765070D4 953437573746F6D50616765310D4578706C69636974576964746803F1010E4578706C696369744865696768740339010000F 110544E65774E6F7465626F6F6B5061676509496E6E6572506167650D4578706C69636974576964746803F1010E4578706C6 963697448656967687403390100F10C544E65774E6F7465626F6F6B0D496E6E65724E6F7465626F6F6B00F110544E65774E6 F7465626F6F6B506167650B4C6963656E7365506167650C50726576696F757350616765070D4953437573746F6D506167653 10D4578706C69636974576964746803A1010E4578706C6963697448656967687403ED00000010544E65774E6F7465626F6F6 B506167650D4953437573746F6D50616765310743617074696F6E06154953437573746F6D50616765315F43617074696F6E0 B4465736372697074696F6E06194953437573746F6D50616765315F4465736372697074696F6E0C50726576696F757350616 765070B57656C636F6D6550616765084E65787450616765070B4C6963656E736550616765000A545363726F6C6C426F780A5 363726F6C6C426F7831044C656674020003546F70020005576964746803A1010648656967687403E900085461624F7264657 20200000C544269746D6170496D6167650C4269746D6170496D61676531044C656674020603546F700206055769647468035 901064865696768740328230000000000000000

это

//прокручиваем вниз
procedure TMainForm.ScrollBox1MouseWheelDown(Sender: TObject;
Shift: TShiftState; MousePos: TPoint; var Handled: Boolean);
begin
Scrollbox1.VertScrollBar.Position:= Scrollbox1.VertScrollBar.Position+4;
end;

//прокручиваем вверх
procedure TMainForm.ScrollBox1MouseWheelUp(Sender: TObject; Shift: TShiftState;
MousePos: TPoint; var Handled: Boolean);
begin
Scrollbox1.VertScrollBar.Position:= Scrollbox1.VertScrollBar.Position-4;
end;

источник http://delphicode.org/system/mouse_wheel_scrollbox.htm
я не могу :(
но очень нужно потому что
http://img84.imageshack.us/img84/6084/13549689.png (http://imageshack.us/photo/my-images/84/13549689.png/)

sergey3695
06-04-2012, 19:23
запускается деинсталлятор »
какой?
можно пример? »
http://i33.fastpic.ru/thumb/2012/0406/34/6b8c913f6667cb5c43ec5a483fe7b334.jpeg (http://fastpic.ru/view/33/2012/0406/6b8c913f6667cb5c43ec5a483fe7b334.jpg.html)
#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
AppMutex=MyProgramMutexUniqueName
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;
ISDoneProgressBar1: TNewProgressBar;
#ifdef SecondProgressBar
LabelPct2: TLabel;
ISDoneProgressBar2:TNewProgressBar;
#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
if OveralPct<=1000 then ISDoneProgressBar1.Position := OveralPct;
LabelPct1.Caption := IntToStr(OveralPct div 10)+'.'+chr(48 + OveralPct mod 10)+'%';
#ifdef SecondProgressBar
if CurrentPct<=1000 then ISDoneProgressBar2.Position := CurrentPct;
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;
ISDoneProgressBar1.Hide;
LabelPct1.Hide;
LabelCurrFileName.Hide;
LabelTime1.Hide;
LabelTime2.Hide;
MyCancelButton.Hide;
#ifdef SecondProgressBar
ISDoneProgressBar2.Hide;
LabelPct2.Hide;
#endif
end;

procedure CreateControls;
var PBTop:integer;
begin
PBTop:=ScaleY(50);
ISDoneProgressBar1 := TNewProgressBar.Create(WizardForm);
with ISDoneProgressBar1 do begin
Parent := WizardForm.InstallingPage;
Height := WizardForm.ProgressGauge.Height;
Left := ScaleX(0);
Top := PBTop;
Width := ScaleX(365);
Max := 1000;
end;
LabelPct1 := TLabel.Create(WizardForm);
with LabelPct1 do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Left := ISDoneProgressBar1.Width+ScaleX(5);
Top := ISDoneProgressBar1.Top + ScaleY(2);
Width := ScaleX(80);
end;
LabelCurrFileName := TLabel.Create(WizardForm);
with LabelCurrFileName do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Width := ISDoneProgressBar1.Width+ScaleX(30);
Left := ScaleX(0);
Top := ScaleY(30);
end;
#ifdef SecondProgressBar
PBTop:=PBTop+ScaleY(25);
ISDoneProgressBar2 := TNewProgressBar.Create(WizardForm);
with ISDoneProgressBar2 do begin
Parent := WizardForm.InstallingPage;
Left := ScaleX(0);
Top := PBTop+ScaleY(8);
Width := ISDoneProgressBar1.Width;
Max := 1000;
Height := WizardForm.ProgressGauge.Height;
end;
LabelPct2 := TLabel.Create(WizardForm);
with LabelPct2 do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Left := ISDoneProgressBar2.Width+ScaleX(5);
Top := ISDoneProgressBar2.Top + ScaleY(2);
Width := ScaleX(80);
end;
#endif
LabelTime1 := TLabel.Create(WizardForm);
with LabelTime1 do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Width := ISDoneProgressBar1.Width div 2;
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 := ISDoneProgressBar1.Width div 2;
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}\*.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;

procedure InitializeWizard();
begin
CreateMutex('MyProgramMutexUniqueName');
end;
P.S я б раньше ответил, но был занят. Так что смог только щас.

El Sanchez
06-04-2012, 21:27
Может пожалуйста кто-нибудь добавить сюда »
Johny777, добавь в нужные места:

const
WM_MOUSEWHEEL = $20A;

function GetWindowRect(hWnd: HWND; var lpRect: TRect): Boolean; external 'GetWindowRect@user32.dll stdcall';

var
rt: TRect;

procedure AppOnMessage(var Msg: TMsg; var Handled: Boolean);
begin
case Msg.message of
WM_MOUSEWHEEL: begin
if WizardForm.CurPageID = IsCustomPage1.ID then
begin
GetWindowRect(ScrollBox1.Handle, rt);
if (Msg.pt.x > rt.Left) and (Msg.pt.x < rt.Right) and (Msg.pt.y > rt.Top) and (Msg.pt.y < rt.Bottom) then
if Msg.wParam > 0 then ScrollBox1.VertScrollBar.Position:= ScrollBox1.VertScrollBar.Position - 16 else ScrollBox1.VertScrollBar.Position:= ScrollBox1.VertScrollBar.Position + 16;
Handled := True;
end;
end;
end;
end;
...
Application.OnMessage := @AppOnMessage; //где-нибудь в InitializeWizard или в твоей RedesignWizardForm

Johny777
06-04-2012, 22:36
El Sanchez,
спасибо тебе огромное
мне так сильно этого не хватало!
результат http://sendfile.su/566305 :)

sergey3695,
честно говоря исдан посмотрел справку и пример глянул и всё
опыта нет
если там через библиотеку идёт удаление , то ничем помочь не могу




© OSzone.net 2001-2012