PDA

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


Страниц : 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 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 [147] 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188

Kizekil
03-09-2011, 08:16
Как сделать чтоб приветстие было в таком тёмном окне? http://lostpic.net/images/d661afc1513176c263fd82c67e31e50c.png

http://lostpic.net/images/531a98735da31e1f617a446c754e6049.png Это когда в секции [Code] два раза написано procedure InitializeWizard();

insombia
03-09-2011, 14:59
Kizekil Как сделать чтоб приветстие было в таком тёмном окне?
В фотошопе нарисовать и потом через form desinger текст переместить в то окно
Это когда в секции [code] два раза написано procedure InitializeWizard();
procedure InitializeWizard();
begin
InitializeWizard1();
InitializeWizard2();
end; и так далее перед этим в любом коде где есть InitializeWizard ставь 1 и так далее

valyok666
03-09-2011, 15:54
insombia, коды можно совмещать надо читать урок от рикилл

Devils Night
04-09-2011, 00:44
Это когда в секции два раза написано procedure InitializeWizard(); »
Вот в помощь может пригодится.
[CODE]// ******************************************************** События установки ********************************************************

[ Code]
// События установки имеющие дубликацию

function BackButtonClick(CurPageID: Integer): Boolean;
begin
Result := BackButtonClick1(CurPageID); if not Result then exit;
// Result := BackButtonClick2(CurPageID); if not Result then exit;
// Result := BackButtonClick3(CurPageID); if not Result then exit;
// Result := BackButtonClick4(CurPageID); if not Result then exit;
// Result := BackButtonClick5(CurPageID); if not Result then exit;
// Result := BackButtonClick6(CurPageID); if not Result then exit;
// Result := BackButtonClick7(CurPageID); if not Result then exit;
// Result := BackButtonClick8(CurPageID); if not Result then exit;
// Result := BackButtonClick9(CurPageID); if not Result then exit;
// Result := BackButtonClick10(CurPageID); if not Result then exit;
end;

procedure CurPageChanged(CurPageID: Integer);
begin
CurPageChanged1(CurPageID);
// CurPageChanged2(CurPageID);
// CurPageChanged3(CurPageID);
// CurPageChanged4(CurPageID);
// CurPageChanged5(CurPageID);
// CurPageChanged6(CurPageID);
// CurPageChanged7(CurPageID);
// CurPageChanged8(CurPageID);
// CurPageChanged9(CurPageID);
// CurPageChanged10(CurPageID);
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
CurStepChanged1(CurStep);
// CurStepChanged2(CurStep);
// CurStepChanged3(CurStep);
// CurStepChanged4(CurStep);
// CurStepChanged5(CurStep);
// CurStepChanged6(CurStep);
// CurStepChanged7(CurStep);
// CurStepChanged8(CurStep);
// CurStepChanged9(CurStep);
// CurStepChanged10(CurStep);
end;

procedure DeinitializeSetup();
begin
DeinitializeSetup1();
// DeinitializeSetup2();
// DeinitializeSetup3();
// DeinitializeSetup4();
// DeinitializeSetup5();
// DeinitializeSetup6();
// DeinitializeSetup7();
// DeinitializeSetup8();
// DeinitializeSetup9();
// DeinitializeSetup10();
end;

function GetCustomSetupExitCode(): Integer;
begin
Result := GetCustomSetupExitCode1(); if Result>0 then exit;
// Result := GetCustomSetupExitCode2(); if Result>0 then exit;
// Result := GetCustomSetupExitCode3(); if Result>0 then exit;
// Result := GetCustomSetupExitCode4(); if Result>0 then exit;
// Result := GetCustomSetupExitCode5(); if Result>0 then exit;
// Result := GetCustomSetupExitCode6(); if Result>0 then exit;
// Result := GetCustomSetupExitCode7(); if Result>0 then exit;
// Result := GetCustomSetupExitCode8(); if Result>0 then exit;
// Result := GetCustomSetupExitCode9(); if Result>0 then exit;
// Result := GetCustomSetupExitCode10(); if Result>0 then exit;
end;

function InitializeSetup(): Boolean;
begin
Result := InitializeSetup1(); if not Result then exit;
// Result := InitializeSetup2(); if not Result then exit;
// Result := InitializeSetup3(); if not Result then exit;
// Result := InitializeSetup4(); if not Result then exit;
// Result := InitializeSetup5(); if not Result then exit;
// Result := InitializeSetup6(); if not Result then exit;
// Result := InitializeSetup7(); if not Result then exit;
// Result := InitializeSetup8(); if not Result then exit;
// Result := InitializeSetup9(); if not Result then exit;
// Result := InitializeSetup10(); if not Result then exit;

end;

procedure InitializeWizard();
begin
InitializeWizard1();
// InitializeWizard2();
// InitializeWizard3();
// InitializeWizard4();
// InitializeWizard5();
// InitializeWizard6();
// InitializeWizard7();
// InitializeWizard8();
// InitializeWizard9();
// InitializeWizard10();
end;

function NeedRestart(): Boolean;
begin
Result := NeedRestart1(); if Result then exit;
// Result := NeedRestart2(); if Result then exit;
// Result := NeedRestart3(); if Result then exit;
// Result := NeedRestart4(); if Result then exit;
// Result := NeedRestart5(); if Result then exit;
// Result := NeedRestart6(); if Result then exit;
// Result := NeedRestart7(); if Result then exit;
// Result := NeedRestart8(); if Result then exit;
// Result := NeedRestart9(); if Result then exit;
// Result := NeedRestart10(); if Result then exit;
end;

function NextButtonClick(CurPageID: Integer): Boolean;
begin
Result := NextButtonClick1(CurPageID); if not Result then exit;
// Result := NextButtonClick2(CurPageID); if not Result then exit;
// Result := NextButtonClick3(CurPageID); if not Result then exit;
// Result := NextButtonClick4(CurPageID); if not Result then exit;
// Result := NextButtonClick5(CurPageID); if not Result then exit;
// Result := NextButtonClick6(CurPageID); if not Result then exit;
// Result := NextButtonClick7(CurPageID); if not Result then exit;
// Result := NextButtonClick8(CurPageID); if not Result then exit;
// Result := NextButtonClick9(CurPageID); if not Result then exit;
// Result := NextButtonClick10(CurPageID); if not Result then exit;
end;

procedure RegisterPreviousData(PreviousDataKey: Integer);
begin
RegisterPreviousData1(PreviousDataKey);
// RegisterPreviousData2(PreviousDataKey);
// RegisterPreviousData3(PreviousDataKey);
// RegisterPreviousData4(PreviousDataKey);
// RegisterPreviousData5(PreviousDataKey);
// RegisterPreviousData6(PreviousDataKey);
// RegisterPreviousData7(PreviousDataKey);
// RegisterPreviousData8(PreviousDataKey);
// RegisterPreviousData9(PreviousDataKey);
// RegisterPreviousData10(PreviousDataKey);
end;

function ShouldSkipPage(PageID: Integer): Boolean;
begin
Result := ShouldSkipPage1(PageID); if not Result then exit;
// Result := ShouldSkipPage2(PageID); if not Result then exit;
// Result := ShouldSkipPage3(PageID); if not Result then exit;
// Result := ShouldSkipPage4(PageID); if not Result then exit;
// Result := ShouldSkipPage5(PageID); if not Result then exit;
// Result := ShouldSkipPage6(PageID); if not Result then exit;
// Result := ShouldSkipPage7(PageID); if not Result then exit;
// Result := ShouldSkipPage8(PageID); if not Result then exit;
// Result := ShouldSkipPage9(PageID); if not Result then exit;
// Result := ShouldSkipPage10(PageID); if not Result then exit;
end;




// События установки не имеющие дубликацию
procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
begin

end;

function CheckPassword(Password: String): Boolean;
begin

end;

function CheckSerial(Serial: String): Boolean;
begin

end;

function PrepareToInstall(var NeedsRestart: Boolean): String;
begin

end;

function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
begin

end;




// ******************************************************** События удаления********************************************************
// События удаления имеющие дубликацию

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
CurUninstallStepChanged1(CurUninstallStep);
// CurUninstallStepChanged2(CurUninstallStep);
// CurUninstallStepChanged3(CurUninstallStep);
// CurUninstallStepChanged4(CurUninstallStep);
// CurUninstallStepChanged5(CurUninstallStep);
// CurUninstallStepChanged6(CurUninstallStep);
// CurUninstallStepChanged7(CurUninstallStep);
// CurUninstallStepChanged8(CurUninstallStep);
// CurUninstallStepChanged9(CurUninstallStep);
// CurUninstallStepChanged10(CurUninstallStep);
end;

procedure DeinitializeUninstall();
begin
DeinitializeUninstall1();
// DeinitializeUninstall2();
// DeinitializeUninstall3();
// DeinitializeUninstall4();
// DeinitializeUninstall5();
// DeinitializeUninstall6();
// DeinitializeUninstall7();
// DeinitializeUninstall8();
// DeinitializeUninstall9();
// DeinitializeUninstall10();
end;

function InitializeUninstall(): Boolean;
begin
Result := InitializeUninstall1(); if not Result then exit;
// Result := InitializeUninstall2(); if not Result then exit;
// Result := InitializeUninstall3(); if not Result then exit;
// Result := InitializeUninstall4(); if not Result then exit;
// Result := InitializeUninstall5(); if not Result then exit;
// Result := InitializeUninstall6(); if not Result then exit;
// Result := InitializeUninstall7(); if not Result then exit;
// Result := InitializeUninstall8(); if not Result then exit;
// Result := InitializeUninstall9(); if not Result then exit;
// Result := InitializeUninstall10(); if not Result then exit;
end;

procedure InitializeUninstallProgressForm();
begin
InitializeUninstallProgressForm1();
// InitializeUninstallProgressForm2();
// InitializeUninstallProgressForm3();
// InitializeUninstallProgressForm4();
// InitializeUninstallProgressForm5();
// InitializeUninstallProgressForm6();
// InitializeUninstallProgressForm7();
// InitializeUninstallProgressForm8();
// InitializeUninstallProgressForm9();
// InitializeUninstallProgressForm10();
end;

function UninstallNeedRestart(): Boolean;
begin
Result := UninstallNeedRestart1(); if Result then exit;
// Result := UninstallNeedRestart2(); if Result then exit;
// Result := UninstallNeedRestart3(); if Result then exit;
// Result := UninstallNeedRestart4(); if Result then exit;
// Result := UninstallNeedRestart5(); if Result then exit;
// Result := UninstallNeedRestart6(); if Result then exit;
// Result := UninstallNeedRestart7(); if Result then exit;
// Result := UninstallNeedRestart8(); if Result then exit;
// Result := UninstallNeedRestart9(); if Result then exit;
// Result := UninstallNeedRestart10(); if Result then exit;
end;

insombia
04-09-2011, 13:53
del

Rikill
04-09-2011, 14:27
insombia, удали создание кнопки вручную, если не ошибаюсь это MyCancelButton и раскрой стандартную отмену удалив строку:
WizardForm.CancelButton.Visible:=false;
потом повесь на ст. отмену удаление:
WizardForm.CancelButton.OnClick:=@CancelButtonOnClick;

Raf-9600
04-09-2011, 17:05
Ктонить может объединить этот код
#define TIME_FOR_VIEW 5

[C0de]
procedure ChangeCaption(str: string);
begin
WizardForm.StatusLabel.Caption:= str;
end;


function enabledesc(ComponentsListHandle: HWND; DescLabelHandle: HWND; DescStrings: PChar): BOOL; external 'enabledesc@files:descctrl.dll stdcall';

function disabledesc(): BOOL; external 'disabledesc@files:descctrl.dll stdcall';

var
Info: TNewStaticText;
InfoCaption: TNewStaticText;
InfoPanel: TPanel;

NeedSize:Integer;
FreeMB, TotalMB: Cardinal;
NeedSpaceLabel: TLabel;
n: Integer;
VolumeName, FileSystemName: String;
VolumeSerialNo, MaxComponentLength, FileSystemFlags: Longint;
ListBox: TListBox;
StartMenuTreeView: TStartMenuFolderTreeView;

procedure GetFreeSpaceCaption(Sender: TObject);
var
Path: String;
begin
Path := ExtractFileDrive(WizardForm.DirEdit.Text);
GetSpaceOnDisk(Path, True, FreeMB, TotalMB);
if FreeMB < NeedSize then
WizardForm.NextButton.Enabled := False else
WizardForm.NextButton.Enabled := True; end;

procedure GetNeedSpaceCaption;
begin
if NeedSize > 1024 then
NeedSpaceLabel.Caption := 'Требуется как минимум '+ FloatToStr(round(NeedSize/1024*100)/100) + ' Гб свободного дискового пространства.' else
NeedSpaceLabel.Caption := 'Требуется как минимум '+ IntToStr(NeedSize)+ ' Мб свободного дискового пространства.';end;

const oneMB= 1024*1024;
function GetLogicalDrives: DWord; external 'GetLogicalDrives@kernel32.dll stdcall';
function GetDriveType(nDrive: String): Longint; external 'GetDriveTypeA@kernel32.dll stdcall';
function GetVolumeInformation(PathName,VolumeName: PChar; VolumeNameSize,VolumeSerialNumber,MaxComponentLength,FileSystemFlags: Longint; FileSystemName: PChar; FileSystemNameSize: Longint): Longint; external 'GetVolumeInformationA@kernel32.dll stdcall';
function MessageBox(hWnd: Integer; lpText, lpCaption: String; uType: Cardinal): Integer; external 'MessageBoxA@user32.dll stdcall';

Function ByteOrTB(Bytes: Extended; noMB: Boolean): String; { Перевод числа в значение бт/Кб/Мб/Гб/Тб (до 3х знаков после запятой)}
Begin
if not noMB then Result:= FloatToStr(Int(Bytes)) +' Мб' else
if Bytes < 1024 then Result:= FloatToStr(Int(Bytes)) +' Бт' else
if Bytes/1024 < 1024 then Result:= FloatToStr(round((Bytes/1024)*10)/10) +' Кб' else
If Bytes/oneMB < 1024 then Result:= FloatToStr(round(Bytes/oneMB*100)/100) +' Мб' else
If Bytes/oneMB/1000 < 1024 then Result:= FloatToStr(round(Bytes/oneMB/1024*1000)/1000) +' Гб' else
Result:= FloatToStr(round(Bytes/oneMB/oneMB*1000)/1000) +' Тб'
StringChange(Result, ',', '.')
End;

Function DelSP(String: String): String; { Удаление начальных, конечных и повторных пробелов }
Begin while (Pos(' ', String) > 0) do Delete(String, Pos(' ', String), 1); Result:= Trim(String); End;

Function CutString(String: String; MaxLength: Longint): String; { Обрезать строку до заданного кол-ва символов}
Begin
if Length(String) > MaxLength then Result:= Copy(String, 1, 6) +'...'+ Copy(String, Length(String) - MaxLength +9, MaxLength)
else Result:= String;
End;

Procedure GetDiskInfo(Disk: String);
Begin
FileSystemName:= StringOfChar(' ', 32); VolumeName:= StringOfChar(' ', 256);
GetVolumeInformation(Disk, VolumeName, 255, VolumeSerialNo, MaxComponentLength, FileSystemFlags, FileSystemName, 31);
FileSystemName:= DelSp(FileSystemName); VolumeName:= DelSp(VolumeName); if VolumeName='' then VolumeName:='без метки';
End;

Procedure ListBoxRefresh; var FreeB, TotalB: Cardinal; Path, String: string; Begin
ListBox.Items.Clear
for n:= 1 to 31 do // диск 'А' пропустить
if (GetLogicalDrives and (1 shl n)) > 0 then
if (GetDriveType(Chr(ord('A') + n) +':\') = 2) or (GetDriveType(Chr(ord('A') + n) +':\') = 3) then
if GetSpaceOnDisk(Chr(ord('A') + n) +':\', True, FreeMB, TotalMB) then ListBox.Items.Add(Chr(ord('A') + n) +':');
for n:= 0 to ListBox.Items.Count -1 do begin
Path:= Copy(ListBox.Items[n],1,2) +'\' { если в накопителе нет диска, пропустить обновление }
if GetSpaceOnDisk(Path, False, FreeB, TotalB) and GetSpaceOnDisk(Path, True, FreeMB, TotalMB) then begin GetDiskInfo(Path);
if FreeB >= $7FFFFFFF then String:= PadL(ByteOrTB(FreeMB*oneMB, true),10) else String:= PadL(ByteOrTB(FreeB, true),10);
if TotalB >= $7FFFFFFF then begin TotalB:= TotalMB; FreeB:= FreeMB; String:= PadL(ByteOrTB(TotalMB*oneMB, true),11) +' всего -'+ String end else String:= PadL(ByteOrTB(TotalB, true),11) +' всего| '+ String;
ListBox.Items[n]:= Copy(Path,1,2) + String + PadL(FloatToStr(round(FreeB/TotalB*100)),3)+ '% своб|'+ PadL(FileSystemName,5)+ '| '+ CutString(VolumeName,9); end; end;
End;

Procedure ObjectOnClick(Sender: TObject); Begin
Case TObject(Sender) of
ListBox: for n:= 0 to ListBox.Items.Count-1 do if ListBox.Selected[n] then WizardForm.DirEdit.Text:= Copy(ListBox.Items[n],1,1) +Copy(WizardForm.DirEdit.Text, 2, Length(WizardForm.DirEdit.Text))
StartMenuTreeView: if StartMenuTreeView.Directory <> '' then WizardForm.GroupEdit.Text:= StartMenuTreeView.Directory else WizardForm.GroupEdit.Text:= '{#SetupSetting("DefaultGroupName")}'
WizardForm.NoIconsCheck: begin WizardForm.GroupEdit.Enabled:= not(WizardForm.GroupEdit.Enabled); StartMenuTreeView.Enabled:= WizardForm.GroupEdit.Enabled; WizardForm.GroupBrowseButton.Enabled:= WizardForm.GroupEdit.Enabled end;
end; End;

procedure InitializeWizard1();
begin
with WizardForm do begin
with MainPanel do
Height := Height - 1;
with WizardSmallBitmapImage do begin
Left := 0;
Top := 0;
Height := 58; //Размер рисунка
Width := 497; //
end;
with PageNameLabel do begin
Width := Width - 497; //Поставьте здесь значения на 0, если хотите вернуть текст
Left := Left + 497; //
end;
with PageDescriptionLabel do begin
Width := Width - 497; //Поставьте здесь значения на 0, если хотите вернуть текст
Left := Left + 497; //
end;
end;
end;

procedure InitializeWizard2();
begin
NeedSize := 510; //Здесь указывается место для приложения
WizardForm.DiskSpaceLabel.Hide;
NeedSpaceLabel := TLabel.Create(WizardForm);
with NeedSpaceLabel do
begin
Parent := WizardForm.SelectDirPage;
Left := ScaleX(0);
Top := ScaleY(220);
Width := ScaleX(209);
Height := ScaleY(13);
end;
ListBox:= TListBox.Create(WizardForm)
ListBox.SetBounds(WizardForm.DirEdit.Left, WizardForm.DirEdit.Top + WizardForm.DirEdit.Height + 8, WizardForm.DirBrowseButton.Left + WizardForm.DirBrowseButton.Width - WizardForm.DirEdit.Left, WizardForm.DiskSpaceLabel.Top - (WizardForm.DirEdit.Top + WizardForm.DirEdit.Height + 12))
ListBox.Font.Size:= 9
ListBox.Font.Style:= []
ListBox.Font.Name:= 'Courier New';
ListBox.OnClick:= @ObjectOnClick;
ListBox.Parent:= WizardForm.SelectDirPage;
WizardForm.DirEdit.OnChange := @GetFreeSpaceCaption;
WizardForm.DirEdit.Text := WizardForm.DirEdit.Text + #0;
end;

procedure CurPageChanged1(CurPageID: Integer);
begin
if CurPageID=wpSelectDir then
begin
GetNeedSpaceCaption;
if FreeMB < NeedSize then
WizardForm.NextButton.Enabled:=False
ListBoxRefresh
end;
end;

procedure InitializeWizard3();
begin
WizardForm.TYPESCOMBO.Visible:= false;
WizardForm.ComponentsList.Height := WizardForm.ComponentsList.Height + WizardForm.ComponentsList.Top - WizardForm.TYPESCOMBO.Top;
WizardForm.ComponentsList.Top := WizardForm.TYPESCOMBO.Top;
WizardForm.ComponentsList.Width := ScaleX(200);
InfoPanel := TPanel.Create(WizardForm);
InfoPanel.Parent := WizardForm.SelectComponentsPage;
InfoPanel.Caption := '';
InfoPanel.Top := WizardForm.ComponentsList.Top;
InfoPanel.Left := ScaleX(216);
InfoPanel.Width := ScaleX(200);
InfoPanel.Height := WizardForm.ComponentsList.Height;
InfoPanel.BevelInner := bvRaised;
InfoPanel.BevelOuter := bvLowered;
InfoCaption := TNewStaticText.Create(WizardForm);
InfoCaption.Parent := WizardForm.SelectComponentsPage;
InfoCaption.Caption := 'Описание';
InfoCaption.Left := ScaleX(224);
InfoCaption.Top := InfoPanel.Top - ScaleY(5);
InfoCaption.Font.Color := clActiveCaption;
Info := TNewStaticText.Create(WizardForm);
Info.Parent := InfoPanel;
Info.AutoSize := False;
Info.Left := ScaleX(6);
Info.Width := ScaleX(188);
Info.Top := ScaleY(12);
Info.Height := WizardForm.ComponentsList.Height - ScaleY(18);
Info.Caption := 'Переместите ваш указатель мыши на компоненты чтобы увидеть их описание.';
Info.WordWrap := true;
//Впишыте описание компонентов
enabledesc(WizardForm.ComponentsList.Handle,Info.Handle,
'Выберите какую игру вы хотите установить.;'+ //Text
'Культовая игра разработанная компанией Condor (позже, переименованная в студию Blizzard North).;'+ //Game\Diablo
'Полная, русская локализация, созданная командой PC Boheme, издаваемая фирмой Фаргус. Отличается отсутствием некоторых монологов.;'+ // \Diablo\Russian
'Оригинальная, англоязычная локализация. Содержит обновленные файлы до последней версии - 1.9b.;'+ // Diablo\Englisch
'Взломать игру, позволив ей запускаться без лицензионного диска. Выбрав этот пункт, вы потеряете возможность играть на офицыальных серверах Battle.net.;'+ // Diablo\Englisch\Crack
'Дополнение для игры Diablo, разработанное и выпущенное компанией Sierra Entertainment в 1997 году. Содержит множество нововведений, среди которых, новый персонаж - Монах. В игре уже активированы некоторые скрытые функции, среди которых, мультиплеер, и Бард;'+ // Game\Hellfire
'Полная, русская локализация, созданная командой PC Boheme, издаваемая фирмой Фаргус. Отличается отсутствием некоторых монологов.;'+ // Hellfire\Russian
'Оригинальная, англоязычная локализация.;'+ // Hellfire\Englisch
'Установить обновление Hellfire до последней версии - 1.01, исправляющее некоторые ошибки, и открывающее возможность игры за нового персонажа - Варвара. Но учтите, что выбрав этот компонент, вы потеряете возможность играть в мультиплеере.;'+ // Game\Hellfire\Englisch\101
'Взломать игру, позволив ей запускаться без требования оригинального CD.;' // Game\Hellfire\Englisch\Crack

);
end;



function ShouldSkipPage(CurPage: Integer): Boolean;
begin
if Pos('/SP-', UpperCase(GetCmdTail)) > 0 then
case CurPage of
wpLicense, wpPassword, wpInfoBefore, wpUserInfo,
wpSelectDir, wpSelectProgramGroup, wpInfoAfter:
Result := True;
end;
end;

const
WM_LBUTTONDOWN = 513;
WM_LBUTTONUP = 514;

procedure InitializeWizard4();
begin
if (Pos('/SP-', UpperCase(GetCmdTail)) > 0) then
begin
PostMessage(WizardForm.NextButton.Handle,WM_LBUTTONDOWN,0,0);
PostMessage(WizardForm.NextButton.Handle,WM_LBUTTONUP,0,0);
end;
end;

procedure CurPageChanged2(CurPageID: Integer);
begin
if (Pos('/SP-', UpperCase(GetCmdTail)) > 0) and
(CurPageID = wpSelectComponents) then
WizardForm.BackButton.Visible := False;
end;


//Проверка на оставшыеся файлы
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
Res: Integer;
begin
case CurUninstallStep of
usPostUninstall:
begin
if DirExists(ExpandConstant('{app}')) then
if ExpandConstant('{language}') = 'ua' then
case MsgBox('Папка "' + ExpandConstant('{app}') + '" не порожня.'#13#13 +
'"Так" – повне видалення всіх файлів у папці, включаючи саму папку.' #13#13 +
'"Ні" – відкрити папку в провіднику, щоб вручну видалити файли.'#13#13 +
'"Скасувати" – нічого не робити, видалити папку пізніше самостійно.', mbInformation, MB_YESNOCANCEL) of

IDYES:
if not DelTree(ExpandConstant('{app}'), True, True, True) then
MsgBox('Папка не видалена.' #13#13 'Папка або один з файлів у ній задіяні іншою програмою.', mbError, MB_OK);

IDNO:
if not ShellExec('open', ExpandConstant('{app}'), '', '', SW_SHOWMAXIMIZED, ewNoWait, Res) then
MsgBox('Помилка відкриття.' #13#13 'Папка не знайдена.', mbError, MB_OK);

IDCANCEL:;
end
else
if ExpandConstant('{language}') = 'ru' then
case MsgBox('Папка "' + ExpandConstant('{app}') + '" не пуста.'#13#13 +
'"Да" – полное удаление всех файлов в папке, включая саму папку.' #13#13 +
'"Нет" – открыть папку в проводнике, чтобы вручную удалить файлы.'#13#13 +
'"Отмена" – ничего не делать, удалить папку позже самостоятельно.', mbInformation, MB_YESNOCANCEL) of

IDYES:
if not DelTree(ExpandConstant('{app}'), True, True, True) then
MsgBox('Папка не удалена.' #13#13 'Папка или один из файлов в ней задействованы другим приложением.', mbError, MB_OK);

IDNO:
if not ShellExec('open', ExpandConstant('{app}'), '', '', SW_SHOWMAXIMIZED, ewNoWait, Res) then
MsgBox('Ошибка открытия.' #13#13 'Папка не найдена.', mbError, MB_OK);

IDCANCEL:;
end
else
case MsgBox('Directory "' + ExpandConstant('{app}') + '" is not empty.'#13#13 +
'"Yes" to delete all of the files in the directory, including the directory itself.' #13#13 +
'"No" to open the directory with explorer to delete the files manually.'#13#13 +
'"Cancel" to do nothing and delete the directory later manually.', mbInformation, MB_YESNOCANCEL) of

IDYES:
if not DelTree(ExpandConstant('{app}'), True, True, True) then
MsgBox('Directory is not deleted.' #13#13 'Directory or one of the files are used by the other application.', mbError, MB_OK);

IDNO:
if not ShellExec('open', ExpandConstant('{app}'), '', '', SW_SHOWMAXIMIZED, ewNoWait, Res) then
MsgBox('Error opening the directory.' #13#13 'Directory is not found.', mbError, MB_OK);

IDCANCEL:;
end
end
end
end;




const
n1=47; //количество слайдов
type
TProc = procedure(HandleW, msg, idEvent, TimeSys: LongWord);
TRandNumbers = array[1..N1] of byte;

function WrapTimerProc(callback:TProc; paramcount:integer):longword;
external 'wrapcallback@files:InnoCallback.dll stdcall';

function SetTimer(hWnd: LongWord; nIDEvent, uElapse: LongWord; lpTimerFunc: LongWord): LongWord;
external 'SetTimer@user32.dll stdcall';

function KillTimer(hWnd: LongWord; nIDEvent: LongWord): LongWord;
external 'KillTimer@user32.dll stdcall';

function get_unique_random_number(X:byte):TRandNumbers;
var
A,b,c: string;
i,j,k:byte;
begin
For i:=1 to X do A:=A+chr(i);
B:='';
For i:=1 to X do begin
j:=Random(Length(A)-1)+1;
C:='';
B:=B + A[j];
for k:=1 to Length(A) do
if k<>j then C:=C+A[k];
A:=C;
end;
for i:=1 to X do Result[i]:=ord(B[i]);
end;

var
TimerID: LongWord;
currTime: Integer;
SplashImage: TBitmapImage;
StatusMessages: TNewStaticText;
bmp: TRandNumbers;
z:byte;

procedure OnTimer(HandleW, msg, idEvent, TimeSys: LongWord);
begin
currTime := currTime + 1;
if (currTime mod {#TIME_FOR_VIEW} = 0)
then begin
SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_'+inttostr(bmp[currTime/{#TIME_FOR_VIEW}])+'.bmp'));
if (currTime/{#TIME_FOR_VIEW} = N1) then currTime:=0;
end;
end;


procedure InitializeWizard5;
begin
bmp:=get_unique_random_number(N1);
ExtractTemporaryFile('Image_'+inttostr(bmp[1])+'.bmp');

currTime := 0;

WizardForm.ProgressGauge.Parent := WizardForm;
WizardForm.ProgressGauge.Top := WizardForm.CancelButton.Top + ScaleY(12);
WizardForm.ProgressGauge.Left := ScaleX(10);
WizardForm.ProgressGauge.Width := WizardForm.MainPanel.Width - ScaleX(20);
WizardForm.ProgressGauge.Height := 16;
WizardForm.ProgressGauge.Hide;

WizardForm.StatusLabel.Parent := WizardForm;
WizardForm.StatusLabel.Top := WizardForm.ProgressGauge.Top - ScaleY(18);
WizardForm.StatusLabel.Left := ScaleX(10);
WizardForm.StatusLabel.Width := ScaleX(397);
WizardForm.StatusLabel.Hide;

SplashImage := TBitmapImage.Create(WizardForm);
SplashImage.Top := 0;
SplashImage.Left := 0;
SplashImage.Width := WizardForm.MainPanel.Width;
SplashImage.Height := WizardForm.Bevel.Top;
SplashImage.Parent := WizardForm.InnerPage;
SplashImage.Stretch := True;
SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_'+inttostr(bmp[1])+'.bmp'));
SplashImage.Hide;
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssInstall then
begin
WizardForm.StatusLabel.Caption := 'Распаковка слайдов...';
for z:=2 to N1 do ExtractTemporaryFile('Image_'+inttostr(bmp[z])+'.bmp');
end;
end;

procedure CurPageChanged3(CurPageID: Integer);
var
pfunc: LongWord;
begin
if (CurPageID = wpInstalling) then
begin
pfunc := WrapTimerProc(@OnTimer, 5);
TimerID := SetTimer(0, 0, 1000, pfunc);
WizardForm.PageNameLabel.Visible := False;
WizardForm.PageDescriptionLabel.Visible := False;
WizardForm.InnerNotebook.Hide;
WizardForm.Bevel1.Hide;
WizardForm.MainPanel.Hide;
WizardForm.PageNameLabel.Hide;
WizardForm.PageDescriptionLabel.Hide;
WizardForm.ProgressGauge.Show;
WizardForm.StatusLabel.Show;
SplashImage.Show;
WizardForm.CancelButton.Enabled := True;
WizardForm.CancelButton.Top := WizardForm.Bevel.Top + ScaleY(100);
end else
begin
WizardForm.ProgressGauge.Hide;
SplashImage.Hide;
WizardForm.FileNameLabel.Hide;
WizardForm.StatusLabel.Hide;
if (CurPageID > wpInstalling) and (CurPageID < wpFinished) then
begin
WizardForm.InnerNotebook.Show;
WizardForm.Bevel1.Show;
WizardForm.MainPanel.Show;
WizardForm.PageNameLabel.Show;
WizardForm.PageDescriptionLabel.Show;
end;
If CurPageID = wpFinished then
end;
end;




procedure InitializeWizard;
begin
InitializeWizard1();
InitializeWizard2();
InitializeWizard3();
InitializeWizard4();
InitializeWizard5();
end;


procedure CurPageChanged(CurPageID: Integer);
begin
CurPageChanged1(CurPageID);
CurPageChanged2(CurPageID);
CurPageChanged3(CurPageID);
end;

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

С этим "Автовыбор диска установки" (http://www.forum.oszone.ru/post-1217528-96.html), и этим Запрет русских символов в пути (http://forum.ru-board.com/topic.cgi?forum=5&topic=35848&start=1484&limit=1&m=2#1)?

VASYAKRN
04-09-2011, 17:10
У кого есть 3д скрипт от рекодинг какой нибуть

xXDx
04-09-2011, 19:23
посмотрите мой инсталл, скажите что тут не хватает, что нужно удалить и как его можно улучшить http://rghost.ru/20444771

insombia
04-09-2011, 20:51
как в ISDone0.6e сделать чтобы писалось просто распаковка файлов а каких именно не указывалось?

No4noylis
04-09-2011, 21:00
insombia, удали LabelCurrFileName и все что с ним связано, либо напиши в коде LabelCurrFileName.Hide; либо напиши LabelCurrFileName.Caption:='Распаковка файлов'; :)

insombia
04-09-2011, 21:20
удали LabelCurrFileName и все что с ним связано
это помогло :)

Rikill
04-09-2011, 22:19
VASYAKRN, тебе уже сказали пи*дуй отсюда, научись писать нормально и адекватно себя вести.

xXDx, прикольный скрипт, молодец, осталось забить пустое место словами.

Raf-9600, #define TIME_FOR_VIEW 5
[setup]
appname=test
appvername=1.0
DefaultDirName=test

[c0de]
procedure ChangeCaption(str: string);
begin
WizardForm.StatusLabel.Caption:= str;
end;

function GetLogicalDrives: DWORD; external 'GetLogicalDrives@kernel32.dll stdcall';
function GetDriveType(lpRootPathName: PChar): Cardinal; external 'GetDriveTypeA@kernel32.dll stdcall';
function enabledesc(ComponentsListHandle: HWND; DescLabelHandle: HWND; DescStrings: PChar): BOOL; external 'enabledesc@files:descctrl.dll stdcall';
function disabledesc(): BOOL; external 'disabledesc@files:descctrl.dll stdcall';
const
DRIVE_FIXED = 3;

var
Info: TNewStaticText;
InfoCaption: TNewStaticText;
InfoPanel: TPanel;

NeedSize:Integer;
FreeMB, TotalMB: Cardinal;
NeedSpaceLabel: TLabel;
n: Integer;
VolumeName, FileSystemName: String;
VolumeSerialNo, MaxComponentLength, FileSystemFlags: Longint;
ListBox: TListBox;
StartMenuTreeView: TStartMenuFolderTreeView;
function NoSD(s: string): string;
var
x, bit, i: Integer;
tp: Cardinal;
sd: string;
begin
sd:= ExpandConstant('{sd}');
Result:= sd;
// Вызываем функцию WinAPI
// Функция возвращает битовую маску установленных логических дисков.
// Бит 0 определяет наличие диска А:, бит 1 - диска B и т.д.
x:= GetLogicalDrives;
if x <> 0 then
// цикл по полученным битам переменной X
for i:= 1 to 64 do
begin
// Накладываем битовую маску для выделения бита с поряковым номером 0
bit:= x and 1;
// нашли логический диск...
if bit = 1 then
begin
// определяем тип логического диска
tp:= GetDriveType(PChar(Chr(64 + i) + ':'));
if tp = DRIVE_FIXED then
// если диск не является системным
if Chr(64 + i) <> Copy(sd, 1, 1) then
begin
Result:= Chr(64 + i) + ':';
Break;
end;
end;
// побитовый сдвиг вправо
x:= x shr 1;
end;
end;

procedure GetFreeSpaceCaption(Sender: TObject);
var
Path: String;
begin
Path := ExtractFileDrive(WizardForm.DirEdit.Text);
GetSpaceOnDisk(Path, True, FreeMB, TotalMB);
if FreeMB < NeedSize then
WizardForm.NextButton.Enabled := False else
WizardForm.NextButton.Enabled := True; end;

procedure GetNeedSpaceCaption;
begin
if NeedSize > 1024 then
NeedSpaceLabel.Caption := 'Требуется как минимум '+ FloatToStr(round(NeedSize/1024*100)/100) + ' Гб свободного дискового пространства.' else
NeedSpaceLabel.Caption := 'Требуется как минимум '+ IntToStr(NeedSize)+ ' Мб свободного дискового пространства.';end;

const oneMB= 1024*1024;
function GetVolumeInformation(PathName,VolumeName: PChar; VolumeNameSize,VolumeSerialNumber,MaxComponentLength,FileSystemFlags: Longint; FileSystemName: PChar; FileSystemNameSize: Longint): Longint; external 'GetVolumeInformationA@kernel32.dll stdcall';
function MessageBox(hWnd: Integer; lpText, lpCaption: String; uType: Cardinal): Integer; external 'MessageBoxA@user32.dll stdcall';

Function ByteOrTB(Bytes: Extended; noMB: Boolean): String; { Перевод числа в значение бт/Кб/Мб/Гб/Тб (до 3х знаков после запятой)}
Begin
if not noMB then Result:= FloatToStr(Int(Bytes)) +' Мб' else
if Bytes < 1024 then Result:= FloatToStr(Int(Bytes)) +' Бт' else
if Bytes/1024 < 1024 then Result:= FloatToStr(round((Bytes/1024)*10)/10) +' Кб' else
If Bytes/oneMB < 1024 then Result:= FloatToStr(round(Bytes/oneMB*100)/100) +' Мб' else
If Bytes/oneMB/1000 < 1024 then Result:= FloatToStr(round(Bytes/oneMB/1024*1000)/1000) +' Гб' else
Result:= FloatToStr(round(Bytes/oneMB/oneMB*1000)/1000) +' Тб'
StringChange(Result, ',', '.')
End;

Function DelSP(String: String): String; { Удаление начальных, конечных и повторных пробелов }
Begin while (Pos(' ', String) > 0) do Delete(String, Pos(' ', String), 1); Result:= Trim(String); End;

Function CutString(String: String; MaxLength: Longint): String; { Обрезать строку до заданного кол-ва символов}
Begin
if Length(String) > MaxLength then Result:= Copy(String, 1, 6) +'...'+ Copy(String, Length(String) - MaxLength +9, MaxLength)
else Result:= String;
End;

Procedure GetDiskInfo(Disk: String);
Begin
FileSystemName:= StringOfChar(' ', 32); VolumeName:= StringOfChar(' ', 256);
GetVolumeInformation(Disk, VolumeName, 255, VolumeSerialNo, MaxComponentLength, FileSystemFlags, FileSystemName, 31);
FileSystemName:= DelSp(FileSystemName); VolumeName:= DelSp(VolumeName); if VolumeName='' then VolumeName:='без метки';
End;

Procedure ListBoxRefresh; var FreeB, TotalB: Cardinal; Path, String: string; Begin
ListBox.Items.Clear
for n:= 1 to 31 do // диск 'А' пропустить
if (GetLogicalDrives and (1 shl n)) > 0 then
if (GetDriveType(Chr(ord('A') + n) +':\') = 2) or (GetDriveType(Chr(ord('A') + n) +':\') = 3) then
if GetSpaceOnDisk(Chr(ord('A') + n) +':\', True, FreeMB, TotalMB) then ListBox.Items.Add(Chr(ord('A') + n) +':');
for n:= 0 to ListBox.Items.Count -1 do begin
Path:= Copy(ListBox.Items[n],1,2) +'\' { если в накопителе нет диска, пропустить обновление }
if GetSpaceOnDisk(Path, False, FreeB, TotalB) and GetSpaceOnDisk(Path, True, FreeMB, TotalMB) then begin GetDiskInfo(Path);
if FreeB >= $7FFFFFFF then String:= PadL(ByteOrTB(FreeMB*oneMB, true),10) else String:= PadL(ByteOrTB(FreeB, true),10);
if TotalB >= $7FFFFFFF then begin TotalB:= TotalMB; FreeB:= FreeMB; String:= PadL(ByteOrTB(TotalMB*oneMB, true),11) +' всего -'+ String end else String:= PadL(ByteOrTB(TotalB, true),11) +' всего| '+ String;
ListBox.Items[n]:= Copy(Path,1,2) + String + PadL(FloatToStr(round(FreeB/TotalB*100)),3)+ '% своб|'+ PadL(FileSystemName,5)+ '| '+ CutString(VolumeName,9); end; end;
End;

Procedure ObjectOnClick(Sender: TObject); Begin
Case TObject(Sender) of
ListBox: for n:= 0 to ListBox.Items.Count-1 do if ListBox.Selected[n] then WizardForm.DirEdit.Text:= Copy(ListBox.Items[n],1,1) +Copy(WizardForm.DirEdit.Text, 2, Length(WizardForm.DirEdit.Text))
StartMenuTreeView: if StartMenuTreeView.Directory <> '' then WizardForm.GroupEdit.Text:= StartMenuTreeView.Directory else WizardForm.GroupEdit.Text:= '{#SetupSetting("DefaultGroupName")}'
WizardForm.NoIconsCheck: begin WizardForm.GroupEdit.Enabled:= not(WizardForm.GroupEdit.Enabled); StartMenuTreeView.Enabled:= WizardForm.GroupEdit.Enabled; WizardForm.GroupBrowseButton.Enabled:= WizardForm.GroupEdit.Enabled end;
end; End;

procedure InitializeWizard1();
begin
with WizardForm do begin
with MainPanel do
Height := Height - 1;
with WizardSmallBitmapImage do begin
Left := 0;
Top := 0;
Height := 58; //Размер рисунка
Width := 497; //
end;
with PageNameLabel do begin
Width := Width - 497; //Поставьте здесь значения на 0, если хотите вернуть текст
Left := Left + 497; //
end;
with PageDescriptionLabel do begin
Width := Width - 497; //Поставьте здесь значения на 0, если хотите вернуть текст
Left := Left + 497; //
end;
end;
end;

procedure InitializeWizard2();
begin
NeedSize := 510; //Здесь указывается место для приложения
WizardForm.DiskSpaceLabel.Hide;
NeedSpaceLabel := TLabel.Create(WizardForm);
with NeedSpaceLabel do
begin
Parent := WizardForm.SelectDirPage;
Left := ScaleX(0);
Top := ScaleY(220);
Width := ScaleX(209);
Height := ScaleY(13);
end;
ListBox:= TListBox.Create(WizardForm)
ListBox.SetBounds(WizardForm.DirEdit.Left, WizardForm.DirEdit.Top + WizardForm.DirEdit.Height + 8, WizardForm.DirBrowseButton.Left + WizardForm.DirBrowseButton.Width - WizardForm.DirEdit.Left, WizardForm.DiskSpaceLabel.Top - (WizardForm.DirEdit.Top + WizardForm.DirEdit.Height + 12))
ListBox.Font.Size:= 9
ListBox.Font.Style:= []
ListBox.Font.Name:= 'Courier New';
ListBox.OnClick:= @ObjectOnClick;
ListBox.Parent:= WizardForm.SelectDirPage;
WizardForm.DirEdit.OnChange := @GetFreeSpaceCaption;
WizardForm.DirEdit.Text := WizardForm.DirEdit.Text + #0;
end;

procedure CurPageChanged1(CurPageID: Integer);
begin
if CurPageID=wpSelectDir then
begin
GetNeedSpaceCaption;
if FreeMB < NeedSize then
WizardForm.NextButton.Enabled:=False
ListBoxRefresh
end;
end;

procedure InitializeWizard3();
begin
WizardForm.TYPESCOMBO.Visible:= false;
WizardForm.ComponentsList.Height := WizardForm.ComponentsList.Height + WizardForm.ComponentsList.Top - WizardForm.TYPESCOMBO.Top;
WizardForm.ComponentsList.Top := WizardForm.TYPESCOMBO.Top;
WizardForm.ComponentsList.Width := ScaleX(200);
InfoPanel := TPanel.Create(WizardForm);
InfoPanel.Parent := WizardForm.SelectComponentsPage;
InfoPanel.Caption := '';
InfoPanel.Top := WizardForm.ComponentsList.Top;
InfoPanel.Left := ScaleX(216);
InfoPanel.Width := ScaleX(200);
InfoPanel.Height := WizardForm.ComponentsList.Height;
InfoPanel.BevelInner := bvRaised;
InfoPanel.BevelOuter := bvLowered;
InfoCaption := TNewStaticText.Create(WizardForm);
InfoCaption.Parent := WizardForm.SelectComponentsPage;
InfoCaption.Caption := 'Описание';
InfoCaption.Left := ScaleX(224);
InfoCaption.Top := InfoPanel.Top - ScaleY(5);
InfoCaption.Font.Color := clActiveCaption;
Info := TNewStaticText.Create(WizardForm);
Info.Parent := InfoPanel;
Info.AutoSize := False;
Info.Left := ScaleX(6);
Info.Width := ScaleX(188);
Info.Top := ScaleY(12);
Info.Height := WizardForm.ComponentsList.Height - ScaleY(18);
Info.Caption := 'Переместите ваш указатель мыши на компоненты чтобы увидеть их описание.';
Info.WordWrap := true;
//Впишыте описание компонентов
enabledesc(WizardForm.ComponentsList.Handle,Info.Handle,
'Выберите какую игру вы хотите установить.;'+ //Text
'Культовая игра разработанная компанией Condor (позже, переименованная в студию Blizzard North).;'+ //Game\Diablo
'Полная, русская локализация, созданная командой PC Boheme, издаваемая фирмой Фаргус. Отличается отсутствием некоторых монологов.;'+ // \Diablo\Russian
'Оригинальная, англоязычная локализация. Содержит обновленные файлы до последней версии - 1.9b.;'+ // Diablo\Englisch
'Взломать игру, позволив ей запускаться без лицензионного диска. Выбрав этот пункт, вы потеряете возможность играть на офицыальных серверах Battle.net.;'+ // Diablo\Englisch\Crack
'Дополнение для игры Diablo, разработанное и выпущенное компанией Sierra Entertainment в 1997 году. Содержит множество нововведений, среди которых, новый персонаж - Монах. В игре уже активированы некоторые скрытые функции, среди которых, мультиплеер, и Бард;'+ // Game\Hellfire
'Полная, русская локализация, созданная командой PC Boheme, издаваемая фирмой Фаргус. Отличается отсутствием некоторых монологов.;'+ // Hellfire\Russian
'Оригинальная, англоязычная локализация.;'+ // Hellfire\Englisch
'Установить обновление Hellfire до последней версии - 1.01, исправляющее некоторые ошибки, и открывающее возможность игры за нового персонажа - Варвара. Но учтите, что выбрав этот компонент, вы потеряете возможность играть в мультиплеере.;'+ // Game\Hellfire\Englisch\101
'Взломать игру, позволив ей запускаться без требования оригинального CD.;' // Game\Hellfire\Englisch\Crack

);
end;



function ShouldSkipPage(CurPage: Integer): Boolean;
begin
if Pos('/SP-', UpperCase(GetCmdTail)) > 0 then
case CurPage of
wpLicense, wpPassword, wpInfoBefore, wpUserInfo,
wpSelectDir, wpSelectProgramGroup, wpInfoAfter:
Result := True;
end;
end;

const
WM_LBUTTONDOWN = 513;
WM_LBUTTONUP = 514;

procedure InitializeWizard4();
begin
if (Pos('/SP-', UpperCase(GetCmdTail)) > 0) then
begin
PostMessage(WizardForm.NextButton.Handle,WM_LBUTTONDOWN,0,0);
PostMessage(WizardForm.NextButton.Handle,WM_LBUTTONUP,0,0);
end;
end;

procedure CurPageChanged2(CurPageID: Integer);
begin
if (Pos('/SP-', UpperCase(GetCmdTail)) > 0) and
(CurPageID = wpSelectComponents) then
WizardForm.BackButton.Visible := False;
end;


//Проверка на оставшыеся файлы
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
Res: Integer;
begin
case CurUninstallStep of
usPostUninstall:
begin
if DirExists(ExpandConstant('{app}')) then
if ExpandConstant('{language}') = 'ua' then
case MsgBox('Папка "' + ExpandConstant('{app}') + '" не порожня.'#13#13 +
'"Так" – повне видалення всіх файлів у папці, включаючи саму папку.' #13#13 +
'"Ні" – відкрити папку в провіднику, щоб вручну видалити файли.'#13#13 +
'"Скасувати" – нічого не робити, видалити папку пізніше самостійно.', mbInformation, MB_YESNOCANCEL) of

IDYES:
if not DelTree(ExpandConstant('{app}'), True, True, True) then
MsgBox('Папка не видалена.' #13#13 'Папка або один з файлів у ній задіяні іншою програмою.', mbError, MB_OK);

IDNO:
if not ShellExec('open', ExpandConstant('{app}'), '', '', SW_SHOWMAXIMIZED, ewNoWait, Res) then
MsgBox('Помилка відкриття.' #13#13 'Папка не знайдена.', mbError, MB_OK);

IDCANCEL:;
end
else
if ExpandConstant('{language}') = 'ru' then
case MsgBox('Папка "' + ExpandConstant('{app}') + '" не пуста.'#13#13 +
'"Да" – полное удаление всех файлов в папке, включая саму папку.' #13#13 +
'"Нет" – открыть папку в проводнике, чтобы вручную удалить файлы.'#13#13 +
'"Отмена" – ничего не делать, удалить папку позже самостоятельно.', mbInformation, MB_YESNOCANCEL) of

IDYES:
if not DelTree(ExpandConstant('{app}'), True, True, True) then
MsgBox('Папка не удалена.' #13#13 'Папка или один из файлов в ней задействованы другим приложением.', mbError, MB_OK);

IDNO:
if not ShellExec('open', ExpandConstant('{app}'), '', '', SW_SHOWMAXIMIZED, ewNoWait, Res) then
MsgBox('Ошибка открытия.' #13#13 'Папка не найдена.', mbError, MB_OK);

IDCANCEL:;
end
else
case MsgBox('Directory "' + ExpandConstant('{app}') + '" is not empty.'#13#13 +
'"Yes" to delete all of the files in the directory, including the directory itself.' #13#13 +
'"No" to open the directory with explorer to delete the files manually.'#13#13 +
'"Cancel" to do nothing and delete the directory later manually.', mbInformation, MB_YESNOCANCEL) of

IDYES:
if not DelTree(ExpandConstant('{app}'), True, True, True) then
MsgBox('Directory is not deleted.' #13#13 'Directory or one of the files are used by the other application.', mbError, MB_OK);

IDNO:
if not ShellExec('open', ExpandConstant('{app}'), '', '', SW_SHOWMAXIMIZED, ewNoWait, Res) then
MsgBox('Error opening the directory.' #13#13 'Directory is not found.', mbError, MB_OK);

IDCANCEL:;
end
end
end
end;




const
n1=47; //количество слайдов
type
TProc = procedure(HandleW, msg, idEvent, TimeSys: LongWord);
TRandNumbers = array[1..N1] of byte;

function WrapTimerProc(callback:TProc; paramcount:integer):longword;
external 'wrapcallback@files:InnoCallback.dll stdcall';

function SetTimer(hWnd: LongWord; nIDEvent, uElapse: LongWord; lpTimerFunc: LongWord): LongWord;
external 'SetTimer@user32.dll stdcall';

function KillTimer(hWnd: LongWord; nIDEvent: LongWord): LongWord;
external 'KillTimer@user32.dll stdcall';

function get_unique_random_number(X:byte):TRandNumbers;
var
A,b,c: string;
i,j,k:byte;
begin
For i:=1 to X do A:=A+chr(i);
B:='';
For i:=1 to X do begin
j:=Random(Length(A)-1)+1;
C:='';
B:=B + A[j];
for k:=1 to Length(A) do
if k<>j then C:=C+A[k];
A:=C;
end;
for i:=1 to X do Result[i]:=ord(B[i]);
end;

var
TimerID: LongWord;
currTime: Integer;
SplashImage: TBitmapImage;
StatusMessages: TNewStaticText;
bmp: TRandNumbers;
z:byte;

procedure OnTimer(HandleW, msg, idEvent, TimeSys: LongWord);
begin
currTime := currTime + 1;
if (currTime mod {#TIME_FOR_VIEW} = 0)
then begin
SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_'+inttostr(bmp[currTime/{#TIME_FOR_VIEW}])+'.bmp'));
if (currTime/{#TIME_FOR_VIEW} = N1) then currTime:=0;
end;
end;


procedure InitializeWizard5;
begin
bmp:=get_unique_random_number(N1);
ExtractTemporaryFile('Image_'+inttostr(bmp[1])+'.bmp');

currTime := 0;

WizardForm.ProgressGauge.Parent := WizardForm;
WizardForm.ProgressGauge.Top := WizardForm.CancelButton.Top + ScaleY(12);
WizardForm.ProgressGauge.Left := ScaleX(10);
WizardForm.ProgressGauge.Width := WizardForm.MainPanel.Width - ScaleX(20);
WizardForm.ProgressGauge.Height := 16;
WizardForm.ProgressGauge.Hide;

WizardForm.StatusLabel.Parent := WizardForm;
WizardForm.StatusLabel.Top := WizardForm.ProgressGauge.Top - ScaleY(18);
WizardForm.StatusLabel.Left := ScaleX(10);
WizardForm.StatusLabel.Width := ScaleX(397);
WizardForm.StatusLabel.Hide;

SplashImage := TBitmapImage.Create(WizardForm);
SplashImage.Top := 0;
SplashImage.Left := 0;
SplashImage.Width := WizardForm.MainPanel.Width;
SplashImage.Height := WizardForm.Bevel.Top;
SplashImage.Parent := WizardForm.InnerPage;
SplashImage.Stretch := True;
SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_'+inttostr(bmp[1])+'.bmp'));
SplashImage.Hide;
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssInstall then
begin
WizardForm.StatusLabel.Caption := 'Распаковка слайдов...';
for z:=2 to N1 do ExtractTemporaryFile('Image_'+inttostr(bmp[z])+'.bmp');
end;
end;

procedure CurPageChanged3(CurPageID: Integer);
var
pfunc: LongWord;
begin
if (CurPageID = wpInstalling) then
begin
pfunc := WrapTimerProc(@OnTimer, 5);
TimerID := SetTimer(0, 0, 1000, pfunc);
WizardForm.PageNameLabel.Visible := False;
WizardForm.PageDescriptionLabel.Visible := False;
WizardForm.InnerNotebook.Hide;
WizardForm.Bevel1.Hide;
WizardForm.MainPanel.Hide;
WizardForm.PageNameLabel.Hide;
WizardForm.PageDescriptionLabel.Hide;
WizardForm.ProgressGauge.Show;
WizardForm.StatusLabel.Show;
SplashImage.Show;
WizardForm.CancelButton.Enabled := True;
WizardForm.CancelButton.Top := WizardForm.Bevel.Top + ScaleY(100);
end else
begin
WizardForm.ProgressGauge.Hide;
SplashImage.Hide;
WizardForm.FileNameLabel.Hide;
WizardForm.StatusLabel.Hide;
if (CurPageID > wpInstalling) and (CurPageID < wpFinished) then
begin
WizardForm.InnerNotebook.Show;
WizardForm.Bevel1.Show;
WizardForm.MainPanel.Show;
WizardForm.PageNameLabel.Show;
WizardForm.PageDescriptionLabel.Show;
end;
If CurPageID = wpFinished then
end;
end;

function NextButtonClick(CurPageID: Integer): Boolean;
var
i,j: integer;
s,c: string;
begin
Result := True;
if CurPageID = wpSelectDir then
begin
c := 'АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюя';
for i:=1 to length(WizardForm.DirEdit.text) do
for j:=1 to length(c) do
begin
if WizardForm.DirEdit.text[i] = c[j] then
begin
s := 'В пути установки присутствуют русские буквы, что недопустимо'#13#13'Пожалуйста, повторите ввод.';
MsgBox(s, mbError, mb_Ok);
Result := False ;
exit;
end
else Result := True;
end;
end;
end;


procedure InitializeWizard;
begin
InitializeWizard1();
InitializeWizard2();
InitializeWizard3();
InitializeWizard4();
InitializeWizard5();
end;


procedure CurPageChanged(CurPageID: Integer);
begin
CurPageChanged1(CurPageID);
CurPageChanged2(CurPageID);
CurPageChanged3(CurPageID);
end;

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

Habetdin, это не я, чесно!

Habetdin
04-09-2011, 22:22
Raf-9600
...
Òðåáóåòñÿ êàê ìèíèìóì »
Эх, что же с кодировкой сделали? =)
#define TIME_FOR_VIEW 5
[setup]
appname=test
appvername=1.0
DefaultDirName=test

[code]
procedure ChangeCaption(str: string);
begin
WizardForm.StatusLabel.Caption:= str;
end;

function GetLogicalDrives: DWORD; external 'GetLogicalDrives@kernel32.dll stdcall';
function GetDriveType(lpRootPathName: PChar): Cardinal; external 'GetDriveTypeA@kernel32.dll stdcall';
function enabledesc(ComponentsListHandle: HWND; DescLabelHandle: HWND; DescStrings: PChar): BOOL; external 'enabledesc@files:descctrl.dll stdcall';
function disabledesc(): BOOL; external 'disabledesc@files:descctrl.dll stdcall';
const
DRIVE_FIXED = 3;

var
Info: TNewStaticText;
InfoCaption: TNewStaticText;
InfoPanel: TPanel;

NeedSize:Integer;
FreeMB, TotalMB: Cardinal;
NeedSpaceLabel: TLabel;
n: Integer;
VolumeName, FileSystemName: String;
VolumeSerialNo, MaxComponentLength, FileSystemFlags: Longint;
ListBox: TListBox;
StartMenuTreeView: TStartMenuFolderTreeView;
function NoSD(s: string): string;
var
x, bit, i: Integer;
tp: Cardinal;
sd: string;
begin
sd:= ExpandConstant('{sd}');
Result:= sd;
// Вызываем функцию WinAPI
// Функция возвращает битовую маску установленных логических дисков.
// Бит 0 определяет наличие диска А:, бит 1 - диска B и т.д.
x:= GetLogicalDrives;
if x <> 0 then
// цикл по полученным битам переменной X
for i:= 1 to 64 do
begin
// Накладываем битовую маску для выделения бита с поряковым номером 0
bit:= x and 1;
// нашли логический диск...
if bit = 1 then
begin
// определяем тип логического диска
tp:= GetDriveType(PChar(Chr(64 + i) + ':'));
if tp = DRIVE_FIXED then
// если диск не является системным
if Chr(64 + i) <> Copy(sd, 1, 1) then
begin
Result:= Chr(64 + i) + ':';
Break;
end;
end;
// побитовый сдвиг вправо
x:= x shr 1;
end;
end;

procedure GetFreeSpaceCaption(Sender: TObject);
var
Path: String;
begin
Path := ExtractFileDrive(WizardForm.DirEdit.Text);
GetSpaceOnDisk(Path, True, FreeMB, TotalMB);
if FreeMB < NeedSize then
WizardForm.NextButton.Enabled := False else
WizardForm.NextButton.Enabled := True; end;

procedure GetNeedSpaceCaption;
begin
if NeedSize > 1024 then
NeedSpaceLabel.Caption := 'Требуется как минимум '+ FloatToStr(round(NeedSize/1024*100)/100) + ' Гб свободного дискового пространства.' else
NeedSpaceLabel.Caption := 'Требуется как минимум '+ IntToStr(NeedSize)+ ' Мб свободного дискового пространства.';end;

const oneMB= 1024*1024;
function GetVolumeInformation(PathName,VolumeName: PChar; VolumeNameSize,VolumeSerialNumber,MaxComponentLength,FileSystemFlags: Longint; FileSystemName: PChar; FileSystemNameSize: Longint): Longint; external 'GetVolumeInformationA@kernel32.dll stdcall';
function MessageBox(hWnd: Integer; lpText, lpCaption: String; uType: Cardinal): Integer; external 'MessageBoxA@user32.dll stdcall';

Function ByteOrTB(Bytes: Extended; noMB: Boolean): String; { Перевод числа в значение бт/Кб/Мб/Гб/Тб (до 3х знаков после запятой)}
Begin
if not noMB then Result:= FloatToStr(Int(Bytes)) +' Мб' else
if Bytes < 1024 then Result:= FloatToStr(Int(Bytes)) +' Бт' else
if Bytes/1024 < 1024 then Result:= FloatToStr(round((Bytes/1024)*10)/10) +' Кб' else
If Bytes/oneMB < 1024 then Result:= FloatToStr(round(Bytes/oneMB*100)/100) +' Мб' else
If Bytes/oneMB/1000 < 1024 then Result:= FloatToStr(round(Bytes/oneMB/1024*1000)/1000) +' Гб' else
Result:= FloatToStr(round(Bytes/oneMB/oneMB*1000)/1000) +' Тб'
StringChange(Result, ',', '.')
End;

Function DelSP(String: String): String; { Удаление начальных, конечных и повторных пробелов }
Begin while (Pos(' ', String) > 0) do Delete(String, Pos(' ', String), 1); Result:= Trim(String); End;

Function CutString(String: String; MaxLength: Longint): String; { Обрезать строку до заданного кол-ва символов}
Begin
if Length(String) > MaxLength then Result:= Copy(String, 1, 6) +'...'+ Copy(String, Length(String) - MaxLength +9, MaxLength)
else Result:= String;
End;

Procedure GetDiskInfo(Disk: String);
Begin
FileSystemName:= StringOfChar(' ', 32); VolumeName:= StringOfChar(' ', 256);
GetVolumeInformation(Disk, VolumeName, 255, VolumeSerialNo, MaxComponentLength, FileSystemFlags, FileSystemName, 31);
FileSystemName:= DelSp(FileSystemName); VolumeName:= DelSp(VolumeName); if VolumeName='' then VolumeName:='без метки';
End;

Procedure ListBoxRefresh; var FreeB, TotalB: Cardinal; Path, String: string; Begin
ListBox.Items.Clear
for n:= 1 to 31 do // диск 'А' пропустить
if (GetLogicalDrives and (1 shl n)) > 0 then
if (GetDriveType(Chr(ord('A') + n) +':\') = 2) or (GetDriveType(Chr(ord('A') + n) +':\') = 3) then
if GetSpaceOnDisk(Chr(ord('A') + n) +':\', True, FreeMB, TotalMB) then ListBox.Items.Add(Chr(ord('A') + n) +':');
for n:= 0 to ListBox.Items.Count -1 do begin
Path:= Copy(ListBox.Items[n],1,2) +'\' { если в накопителе нет диска, пропустить обновление }
if GetSpaceOnDisk(Path, False, FreeB, TotalB) and GetSpaceOnDisk(Path, True, FreeMB, TotalMB) then begin GetDiskInfo(Path);
if FreeB >= $7FFFFFFF then String:= PadL(ByteOrTB(FreeMB*oneMB, true),10) else String:= PadL(ByteOrTB(FreeB, true),10);
if TotalB >= $7FFFFFFF then begin TotalB:= TotalMB; FreeB:= FreeMB; String:= PadL(ByteOrTB(TotalMB*oneMB, true),11) +' всего -'+ String end else String:= PadL(ByteOrTB(TotalB, true),11) +' всего| '+ String;
ListBox.Items[n]:= Copy(Path,1,2) + String + PadL(FloatToStr(round(FreeB/TotalB*100)),3)+ '% своб|'+ PadL(FileSystemName,5)+ '| '+ CutString(VolumeName,9); end; end;
End;

Procedure ObjectOnClick(Sender: TObject); Begin
Case TObject(Sender) of
ListBox: for n:= 0 to ListBox.Items.Count-1 do if ListBox.Selected[n] then WizardForm.DirEdit.Text:= Copy(ListBox.Items[n],1,1) +Copy(WizardForm.DirEdit.Text, 2, Length(WizardForm.DirEdit.Text))
StartMenuTreeView: if StartMenuTreeView.Directory <> '' then WizardForm.GroupEdit.Text:= StartMenuTreeView.Directory else WizardForm.GroupEdit.Text:= '{#SetupSetting("DefaultGroupName")}'
WizardForm.NoIconsCheck: begin WizardForm.GroupEdit.Enabled:= not(WizardForm.GroupEdit.Enabled); StartMenuTreeView.Enabled:= WizardForm.GroupEdit.Enabled; WizardForm.GroupBrowseButton.Enabled:= WizardForm.GroupEdit.Enabled end;
end; End;

procedure InitializeWizard1();
begin
with WizardForm do begin
with MainPanel do
Height := Height - 1;
with WizardSmallBitmapImage do begin
Left := 0;
Top := 0;
Height := 58; //Размер рисунка
Width := 497; //
end;
with PageNameLabel do begin
Width := Width - 497; //Поставьте здесь значения на 0, если хотите вернуть текст
Left := Left + 497; //
end;
with PageDescriptionLabel do begin
Width := Width - 497; //Поставьте здесь значения на 0, если хотите вернуть текст
Left := Left + 497; //
end;
end;
end;

procedure InitializeWizard2();
begin
NeedSize := 510; //Здесь указывается место для приложения
WizardForm.DiskSpaceLabel.Hide;
NeedSpaceLabel := TLabel.Create(WizardForm);
with NeedSpaceLabel do
begin
Parent := WizardForm.SelectDirPage;
Left := ScaleX(0);
Top := ScaleY(220);
Width := ScaleX(209);
Height := ScaleY(13);
end;
ListBox:= TListBox.Create(WizardForm)
ListBox.SetBounds(WizardForm.DirEdit.Left, WizardForm.DirEdit.Top + WizardForm.DirEdit.Height + 8, WizardForm.DirBrowseButton.Left + WizardForm.DirBrowseButton.Width - WizardForm.DirEdit.Left, WizardForm.DiskSpaceLabel.Top - (WizardForm.DirEdit.Top + WizardForm.DirEdit.Height + 12))
ListBox.Font.Size:= 9
ListBox.Font.Style:= []
ListBox.Font.Name:= 'Courier New';
ListBox.OnClick:= @ObjectOnClick;
ListBox.Parent:= WizardForm.SelectDirPage;
WizardForm.DirEdit.OnChange := @GetFreeSpaceCaption;
WizardForm.DirEdit.Text := WizardForm.DirEdit.Text + #0;
end;

procedure CurPageChanged1(CurPageID: Integer);
begin
if CurPageID=wpSelectDir then
begin
GetNeedSpaceCaption;
if FreeMB < NeedSize then
WizardForm.NextButton.Enabled:=False
ListBoxRefresh
end;
end;

procedure InitializeWizard3();
begin
WizardForm.TYPESCOMBO.Visible:= false;
WizardForm.ComponentsList.Height := WizardForm.ComponentsList.Height + WizardForm.ComponentsList.Top - WizardForm.TYPESCOMBO.Top;
WizardForm.ComponentsList.Top := WizardForm.TYPESCOMBO.Top;
WizardForm.ComponentsList.Width := ScaleX(200);
InfoPanel := TPanel.Create(WizardForm);
InfoPanel.Parent := WizardForm.SelectComponentsPage;
InfoPanel.Caption := '';
InfoPanel.Top := WizardForm.ComponentsList.Top;
InfoPanel.Left := ScaleX(216);
InfoPanel.Width := ScaleX(200);
InfoPanel.Height := WizardForm.ComponentsList.Height;
InfoPanel.BevelInner := bvRaised;
InfoPanel.BevelOuter := bvLowered;
InfoCaption := TNewStaticText.Create(WizardForm);
InfoCaption.Parent := WizardForm.SelectComponentsPage;
InfoCaption.Caption := 'Описание';
InfoCaption.Left := ScaleX(224);
InfoCaption.Top := InfoPanel.Top - ScaleY(5);
InfoCaption.Font.Color := clActiveCaption;
Info := TNewStaticText.Create(WizardForm);
Info.Parent := InfoPanel;
Info.AutoSize := False;
Info.Left := ScaleX(6);
Info.Width := ScaleX(188);
Info.Top := ScaleY(12);
Info.Height := WizardForm.ComponentsList.Height - ScaleY(18);
Info.Caption := 'Переместите ваш указатель мыши на компоненты чтобы увидеть их описание.';
Info.WordWrap := true;
//Впишыте описание компонентов
enabledesc(WizardForm.ComponentsList.Handle,Info.Handle,
'Выберите какую игру вы хотите установить.;'+ //Text
'Культовая игра разработанная компанией Condor (позже, переименованная в студию Blizzard North).;'+ //Game\Diablo
'Полная, русская локализация, созданная командой PC Boheme, издаваемая фирмой Фаргус. Отличается отсутствием некоторых монологов.;'+ // \Diablo\Russian
'Оригинальная, англоязычная локализация. Содержит обновленные файлы до последней версии - 1.9b.;'+ // Diablo\Englisch
'Взломать игру, позволив ей запускаться без лицензионного диска. Выбрав этот пункт, вы потеряете возможность играть на офицыальных серверах Battle.net.;'+ // Diablo\Englisch\Crack
'Дополнение для игры Diablo, разработанное и выпущенное компанией Sierra Entertainment в 1997 году. Содержит множество нововведений, среди которых, новый персонаж - Монах. В игре уже активированы некоторые скрытые функции, среди которых, мультиплеер, и Бард;'+ // Game\Hellfire
'Полная, русская локализация, созданная командой PC Boheme, издаваемая фирмой Фаргус. Отличается отсутствием некоторых монологов.;'+ // Hellfire\Russian
'Оригинальная, англоязычная локализация.;'+ // Hellfire\Englisch
'Установить обновление Hellfire до последней версии - 1.01, исправляющее некоторые ошибки, и открывающее возможность игры за нового персонажа - Варвара. Но учтите, что выбрав этот компонент, вы потеряете возможность играть в мультиплеере.;'+ // Game\Hellfire\Englisch\101
'Взломать игру, позволив ей запускаться без требования оригинального CD.;' // Game\Hellfire\Englisch\Crack

);
end;



function ShouldSkipPage(CurPage: Integer): Boolean;
begin
if Pos('/SP-', UpperCase(GetCmdTail)) > 0 then
case CurPage of
wpLicense, wpPassword, wpInfoBefore, wpUserInfo,
wpSelectDir, wpSelectProgramGroup, wpInfoAfter:
Result := True;
end;
end;

const
WM_LBUTTONDOWN = 513;
WM_LBUTTONUP = 514;

procedure InitializeWizard4();
begin
if (Pos('/SP-', UpperCase(GetCmdTail)) > 0) then
begin
PostMessage(WizardForm.NextButton.Handle,WM_LBUTTONDOWN,0,0);
PostMessage(WizardForm.NextButton.Handle,WM_LBUTTONUP,0,0);
end;
end;

procedure CurPageChanged2(CurPageID: Integer);
begin
if (Pos('/SP-', UpperCase(GetCmdTail)) > 0) and
(CurPageID = wpSelectComponents) then
WizardForm.BackButton.Visible := False;
end;


//Проверка на оставшыеся файлы
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
Res: Integer;
begin
case CurUninstallStep of
usPostUninstall:
begin
if DirExists(ExpandConstant('{app}')) then
if ExpandConstant('{language}') = 'ua' then
case MsgBox('Папка "' + ExpandConstant('{app}') + '" не порожня.'#13#13 +
'"Так" – повне видалення всіх файлів у папці, включаючи саму папку.' #13#13 +
'"Ні" – відкрити папку в провіднику, щоб вручну видалити файли.'#13#13 +
'"Скасувати" – нічого не робити, видалити папку пізніше самостійно.', mbInformation, MB_YESNOCANCEL) of

IDYES:
if not DelTree(ExpandConstant('{app}'), True, True, True) then
MsgBox('Папка не видалена.' #13#13 'Папка або один з файлів у ній задіяні іншою програмою.', mbError, MB_OK);

IDNO:
if not ShellExec('open', ExpandConstant('{app}'), '', '', SW_SHOWMAXIMIZED, ewNoWait, Res) then
MsgBox('Помилка відкриття.' #13#13 'Папка не знайдена.', mbError, MB_OK);

IDCANCEL:;
end
else
if ExpandConstant('{language}') = 'ru' then
case MsgBox('Папка "' + ExpandConstant('{app}') + '" не пуста.'#13#13 +
'"Да" – полное удаление всех файлов в папке, включая саму папку.' #13#13 +
'"Нет" – открыть папку в проводнике, чтобы вручную удалить файлы.'#13#13 +
'"Отмена" – ничего не делать, удалить папку позже самостоятельно.', mbInformation, MB_YESNOCANCEL) of

IDYES:
if not DelTree(ExpandConstant('{app}'), True, True, True) then
MsgBox('Папка не удалена.' #13#13 'Папка или один из файлов в ней задействованы другим приложением.', mbError, MB_OK);

IDNO:
if not ShellExec('open', ExpandConstant('{app}'), '', '', SW_SHOWMAXIMIZED, ewNoWait, Res) then
MsgBox('Ошибка открытия.' #13#13 'Папка не найдена.', mbError, MB_OK);

IDCANCEL:;
end
else
case MsgBox('Directory "' + ExpandConstant('{app}') + '" is not empty.'#13#13 +
'"Yes" to delete all of the files in the directory, including the directory itself.' #13#13 +
'"No" to open the directory with explorer to delete the files manually.'#13#13 +
'"Cancel" to do nothing and delete the directory later manually.', mbInformation, MB_YESNOCANCEL) of

IDYES:
if not DelTree(ExpandConstant('{app}'), True, True, True) then
MsgBox('Directory is not deleted.' #13#13 'Directory or one of the files are used by the other application.', mbError, MB_OK);

IDNO:
if not ShellExec('open', ExpandConstant('{app}'), '', '', SW_SHOWMAXIMIZED, ewNoWait, Res) then
MsgBox('Error opening the directory.' #13#13 'Directory is not found.', mbError, MB_OK);

IDCANCEL:;
end
end
end
end;




const
n1=47; //количество слайдов
type
TProc = procedure(HandleW, msg, idEvent, TimeSys: LongWord);
TRandNumbers = array[1..N1] of byte;

function WrapTimerProc(callback:TProc; paramcount:integer):longword;
external 'wrapcallback@files:InnoCallback.dll stdcall';

function SetTimer(hWnd: LongWord; nIDEvent, uElapse: LongWord; lpTimerFunc: LongWord): LongWord;
external 'SetTimer@user32.dll stdcall';

function KillTimer(hWnd: LongWord; nIDEvent: LongWord): LongWord;
external 'KillTimer@user32.dll stdcall';

function get_unique_random_number(X:byte):TRandNumbers;
var
A,b,c: string;
i,j,k:byte;
begin
For i:=1 to X do A:=A+chr(i);
B:='';
For i:=1 to X do begin
j:=Random(Length(A)-1)+1;
C:='';
B:=B + A[j];
for k:=1 to Length(A) do
if k<>j then C:=C+A[k];
A:=C;
end;
for i:=1 to X do Result[i]:=ord(B[i]);
end;

var
TimerID: LongWord;
currTime: Integer;
SplashImage: TBitmapImage;
StatusMessages: TNewStaticText;
bmp: TRandNumbers;
z:byte;

procedure OnTimer(HandleW, msg, idEvent, TimeSys: LongWord);
begin
currTime := currTime + 1;
if (currTime mod {#TIME_FOR_VIEW} = 0)
then begin
SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_'+inttostr(bmp[currTime/{#TIME_FOR_VIEW}])+'.bmp'));
if (currTime/{#TIME_FOR_VIEW} = N1) then currTime:=0;
end;
end;


procedure InitializeWizard5;
begin
bmp:=get_unique_random_number(N1);
ExtractTemporaryFile('Image_'+inttostr(bmp[1])+'.bmp');

currTime := 0;

WizardForm.ProgressGauge.Parent := WizardForm;
WizardForm.ProgressGauge.Top := WizardForm.CancelButton.Top + ScaleY(12);
WizardForm.ProgressGauge.Left := ScaleX(10);
WizardForm.ProgressGauge.Width := WizardForm.MainPanel.Width - ScaleX(20);
WizardForm.ProgressGauge.Height := 16;
WizardForm.ProgressGauge.Hide;

WizardForm.StatusLabel.Parent := WizardForm;
WizardForm.StatusLabel.Top := WizardForm.ProgressGauge.Top - ScaleY(18);
WizardForm.StatusLabel.Left := ScaleX(10);
WizardForm.StatusLabel.Width := ScaleX(397);
WizardForm.StatusLabel.Hide;

SplashImage := TBitmapImage.Create(WizardForm);
SplashImage.Top := 0;
SplashImage.Left := 0;
SplashImage.Width := WizardForm.MainPanel.Width;
SplashImage.Height := WizardForm.Bevel.Top;
SplashImage.Parent := WizardForm.InnerPage;
SplashImage.Stretch := True;
SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_'+inttostr(bmp[1])+'.bmp'));
SplashImage.Hide;
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssInstall then
begin
WizardForm.StatusLabel.Caption := 'Распаковка слайдов...';
for z:=2 to N1 do ExtractTemporaryFile('Image_'+inttostr(bmp[z])+'.bmp');
end;
end;

procedure CurPageChanged3(CurPageID: Integer);
var
pfunc: LongWord;
begin
if (CurPageID = wpInstalling) then
begin
pfunc := WrapTimerProc(@OnTimer, 5);
TimerID := SetTimer(0, 0, 1000, pfunc);
WizardForm.PageNameLabel.Visible := False;
WizardForm.PageDescriptionLabel.Visible := False;
WizardForm.InnerNotebook.Hide;
WizardForm.Bevel1.Hide;
WizardForm.MainPanel.Hide;
WizardForm.PageNameLabel.Hide;
WizardForm.PageDescriptionLabel.Hide;
WizardForm.ProgressGauge.Show;
WizardForm.StatusLabel.Show;
SplashImage.Show;
WizardForm.CancelButton.Enabled := True;
WizardForm.CancelButton.Top := WizardForm.Bevel.Top + ScaleY(100);
end else
begin
WizardForm.ProgressGauge.Hide;
SplashImage.Hide;
WizardForm.FileNameLabel.Hide;
WizardForm.StatusLabel.Hide;
if (CurPageID > wpInstalling) and (CurPageID < wpFinished) then
begin
WizardForm.InnerNotebook.Show;
WizardForm.Bevel1.Show;
WizardForm.MainPanel.Show;
WizardForm.PageNameLabel.Show;
WizardForm.PageDescriptionLabel.Show;
end;
If CurPageID = wpFinished then
end;
end;

function NextButtonClick(CurPageID: Integer): Boolean;
var
i,j: integer;
s,c: string;
begin
Result := True;
if CurPageID = wpSelectDir then
begin
c := 'АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюя';
for i:=1 to length(WizardForm.DirEdit.text) do
for j:=1 to length(c) do
begin
if WizardForm.DirEdit.text[i] = c[j] then
begin
s := 'В пути установки присутствуют русские буквы, что недопустимо'#13#13'Пожалуйста, повторите ввод.';
MsgBox(s, mbError, mb_Ok);
Result := False ;
exit;
end
else Result := True;
end;
end;
end;


procedure InitializeWizard;
begin
InitializeWizard1();
InitializeWizard2();
InitializeWizard3();
InitializeWizard4();
InitializeWizard5();
end;


procedure CurPageChanged(CurPageID: Integer);
begin
CurPageChanged1(CurPageID);
CurPageChanged2(CurPageID);
CurPageChanged3(CurPageID);
end;

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

Raf-9600
05-09-2011, 00:37
А можно ещё в эту модификацию кода встроить те же кусочки? #define TIME_FOR_VIEW 10
[C0de]
//Ничего не отображающий прогресс-бар
procedure NeaProgress;
begin
WizardForm.ProgressGauge.Style:= npbstMarquee;
end;

const
n1=28; //количество слайдов
oneMB= 1024*1024;

type
TProc = procedure(HandleW, msg, idEvent, TimeSys: LongWord);
TRandNumbers = array[1..N1] of byte;

function GetLogicalDrives: DWord; external 'GetLogicalDrives@kernel32.dll stdcall';
function GetDriveType(nDrive: String): Longint; external 'GetDriveTypeA@kernel32.dll stdcall';
function GetVolumeInformation(PathName,VolumeName: PChar; VolumeNameSize,VolumeSerialNumber,MaxComponentLength,FileSystemFlags: Longint; FileSystemName: PChar; FileSystemNameSize: Longint): Longint; external 'GetVolumeInformationA@kernel32.dll stdcall';
function MessageBox(hWnd: Integer; lpText, lpCaption: String; uType: Cardinal): Integer; external 'MessageBoxA@user32.dll stdcall';

function WrapTimerProc(callback:TProc; paramcount:integer):longword;
external 'wrapcallback@files:InnoCallback.dll stdcall';

function SetTimer(hWnd: LongWord; nIDEvent, uElapse: LongWord; lpTimerFunc: LongWord): LongWord;
external 'SetTimer@user32.dll stdcall';

function KillTimer(hWnd: LongWord; nIDEvent: LongWord): LongWord;
external 'KillTimer@user32.dll stdcall';

function enabledesc(ComponentsListHandle: HWND; DescLabelHandle: HWND; DescStrings: PChar): BOOL; external 'enabledesc@files:descctrl.dll stdcall';

function disabledesc(): BOOL; external 'disabledesc@files:descctrl.dll stdcall';

var
Info, InfoCaption, StatusMessages: TNewStaticText;
InfoPanel: TPanel;

FreeMB, TotalMB: Cardinal;
NeedSpaceLabel: TLabel;
NeedSize, n, currTime: Integer;
VolumeName, FileSystemName, S: String;
VolumeSerialNo, MaxComponentLength, FileSystemFlags: Longint;
ListBox: TListBox;
StartMenuTreeView: TStartMenuFolderTreeView;

Files: Array of String;
TimerID: LongWord;
SplashImage: TBitmapImage;
bmp: TRandNumbers;
z:byte;

procedure ChangeCaption(str: string);
begin
WizardForm.StatusLabel.Caption:= str;
end;

Function StringToArray(Text, Cut: String): array of String; var i, k: Integer;
Begin
SetArrayLength(Result, 0); if Cut = '' then Cut:= #1310; //если шаблон пуст, считаем переводы строк
Repeat k:= Pos(Cut,Text);
if k = 1 then begin Delete(Text, 1, Length(Cut)); CONTINUE
end;
SetArrayLength(Result, GetArrayLength(Result) +1); i:= GetArrayLength(Result) -1;
if k = 0 then
Result[i]:=Text
else begin
Result[i]:= Copy(Text, 1, k -1); Delete(Text, 1, Length(Result[i]) + Length(Cut));
end;
Until Length(Text) * k = 0;
End;

procedure FindFiles(FromDir: String; Mask: String);
var FSR, DSR: TFindRec; FindResult: Boolean;
begin
FindResult:= FindFirst(AddBackslash(FromDir)+Mask, FSR)
while FindResult do begin
if FSR.Attributes and FILE_ATTRIBUTE_DIRECTORY = 0 then begin
S:= S + AddBackslash(fromDir) + FSR.Name +'|';
end;
FindResult:= FindNext(FSR);
end;
FindResult:= FindFirst(AddBackslash(FromDir)+ '*.*', DSR)
while FindResult do begin
if ((DSR.Attributes and FILE_ATTRIBUTE_DIRECTORY) = FILE_ATTRIBUTE_DIRECTORY) and not ((DSR.Name = '.') or (DSR.Name = '..')) then begin
FindFiles(AddBackSlash(FromDir)+DSR.Name, Mask)
end;
FindResult:= FindNext(DSR);
end;
FindClose(FSR); FindClose(DSR)
end;

procedure RecodeOgg;
var ResultCode: integer; CurFile: String;
begin
FindFiles(ExpandConstant('{app}'), '*.ogg') //Находим все файлы по маске, в выбранной папке
Files:= StringToArray(S, '|') //Переводим в массив
WizardForm.ProgressGauge.Max:= GetArrayLength(Files)-1; //Получаем кол-во файлов
WizardForm.ProgressGauge.Position:=0
for n:=(GetArrayLength(Files)-1) downto 0 do begin
CurFile:= Files[n]
StringChange(CurFile, AddBackslash(ExpandConstant('{app}')), '')
Exec(ExpandConstant('{app}\oggdec.exe'), '-Q '+AddQuotes(CurFile), '', SW_Hide, EwWaitUntilTerminated, ResultCode) //Для каждого файла запускаем декодер
DeleteFile(Files[n]) //Удаляем ненужный файл
WizardForm.FilenameLabel.Caption:= Files[n]; //Двигаем прогрессбар
WizardForm.ProgressGauge.Position:= WizardForm.ProgressGauge.Position +1;
end;
DeleteFile(ExpandConstant('{app}\oggdec.exe'))
end;

procedure GetFreeSpaceCaption(Sender: TObject);
var
Path: String;
begin
Path := ExtractFileDrive(WizardForm.DirEdit.Text);
GetSpaceOnDisk(Path, True, FreeMB, TotalMB);
if FreeMB < NeedSize then
WizardForm.NextButton.Enabled := False else
WizardForm.NextButton.Enabled := True; end;

procedure GetNeedSpaceCaption;
begin
if NeedSize > 1024 then
NeedSpaceLabel.Caption := 'Требуется как минимум '+ FloatToStr(round(NeedSize/1024*100)/100) + ' Гб свободного дискового пространства.' else
NeedSpaceLabel.Caption := 'Требуется как минимум '+ IntToStr(NeedSize)+ ' Мб свободного дискового пространства.';
end;


Function ByteOrTB(Bytes: Extended; noMB: Boolean): String; { Перевод числа в значение бт/Кб/Мб/Гб/Тб (до 3х знаков после запятой)}
Begin
if not noMB then Result:= FloatToStr(Int(Bytes)) +' Мб' else
if Bytes < 1024 then Result:= FloatToStr(Int(Bytes)) +' Бт' else
if Bytes/1024 < 1024 then Result:= FloatToStr(round((Bytes/1024)*10)/10) +' Кб' else
If Bytes/oneMB < 1024 then Result:= FloatToStr(round(Bytes/oneMB*100)/100) +' Мб' else
If Bytes/oneMB/1000 < 1024 then Result:= FloatToStr(round(Bytes/oneMB/1024*1000)/1000) +' Гб' else
Result:= FloatToStr(round(Bytes/oneMB/oneMB*1000)/1000) +' Тб'
StringChange(Result, ',', '.')
End;

Function DelSP(String: String): String; { Удаление начальных, конечных и повторных пробелов }
Begin while (Pos(' ', String) > 0) do Delete(String, Pos(' ', String), 1); Result:= Trim(String); End;

Function CutString(String: String; MaxLength: Longint): String; { Обрезать строку до заданного кол-ва символов}
Begin
if Length(String) > MaxLength then Result:= Copy(String, 1, 6) +'...'+ Copy(String, Length(String) - MaxLength +9, MaxLength)
else Result:= String;
End;

Procedure GetDiskInfo(Disk: String);
Begin
FileSystemName:= StringOfChar(' ', 32); VolumeName:= StringOfChar(' ', 256);
GetVolumeInformation(Disk, VolumeName, 255, VolumeSerialNo, MaxComponentLength, FileSystemFlags, FileSystemName, 31);
FileSystemName:= DelSp(FileSystemName); VolumeName:= DelSp(VolumeName); if VolumeName='' then VolumeName:='без метки';
End;

Procedure ListBoxRefresh; var FreeB, TotalB: Cardinal; Path, String: string; Begin
ListBox.Items.Clear
for n:= 1 to 31 do // диск 'А' пропустить
if (GetLogicalDrives and (1 shl n)) > 0 then
if (GetDriveType(Chr(ord('A') + n) +':\') = 2) or (GetDriveType(Chr(ord('A') + n) +':\') = 3) then
if GetSpaceOnDisk(Chr(ord('A') + n) +':\', True, FreeMB, TotalMB) then ListBox.Items.Add(Chr(ord('A') + n) +':');
for n:= 0 to ListBox.Items.Count -1 do begin
Path:= Copy(ListBox.Items[n],1,2) +'\' { если в накопителе нет диска, пропустить обновление }
if GetSpaceOnDisk(Path, False, FreeB, TotalB) and GetSpaceOnDisk(Path, True, FreeMB, TotalMB) then begin GetDiskInfo(Path);
if FreeB >= $7FFFFFFF then String:= PadL(ByteOrTB(FreeMB*oneMB, true),10) else String:= PadL(ByteOrTB(FreeB, true),10);
if TotalB >= $7FFFFFFF then begin TotalB:= TotalMB; FreeB:= FreeMB; String:= PadL(ByteOrTB(TotalMB*oneMB, true),11) +' всего -'+ String end else String:= PadL(ByteOrTB(TotalB, true),11) +' всего| '+ String;
ListBox.Items[n]:= Copy(Path,1,2) + String + PadL(FloatToStr(round(FreeB/TotalB*100)),3)+ '% своб|'+ PadL(FileSystemName,5)+ '| '+ CutString(VolumeName,9); end; end;
End;

Procedure ObjectOnClick(Sender: TObject); Begin
Case TObject(Sender) of
ListBox: for n:= 0 to ListBox.Items.Count-1 do if ListBox.Selected[n] then WizardForm.DirEdit.Text:= Copy(ListBox.Items[n],1,1) +Copy(WizardForm.DirEdit.Text, 2, Length(WizardForm.DirEdit.Text))
StartMenuTreeView: if StartMenuTreeView.Directory <> '' then WizardForm.GroupEdit.Text:= StartMenuTreeView.Directory else WizardForm.GroupEdit.Text:= '{#SetupSetting("DefaultGroupName")}'
WizardForm.NoIconsCheck: begin WizardForm.GroupEdit.Enabled:= not(WizardForm.GroupEdit.Enabled); StartMenuTreeView.Enabled:= WizardForm.GroupEdit.Enabled; WizardForm.GroupBrowseButton.Enabled:= WizardForm.GroupEdit.Enabled end;
end; End;

procedure InitializeWizard1();
begin
with WizardForm do begin
with MainPanel do
Height := Height - 1;
with WizardSmallBitmapImage do begin
Left := 0;
Top := 0;
Height := 58; //Размер рисунка
Width := 497; //
end;
with PageNameLabel do begin
Width := Width - 497; //Поставьте здесь значения на 0, если хотите вернуть текст
Left := Left + 497; //
end;
with PageDescriptionLabel do begin
Width := Width - 497; //Поставьте здесь значения на 0, если хотите вернуть текст
Left := Left + 497; //
end;
end;
end;

procedure InitializeWizard2();
begin
NeedSize := 2500; //Здесь указывается место для приложения
WizardForm.DiskSpaceLabel.Hide;
NeedSpaceLabel := TLabel.Create(WizardForm);
with NeedSpaceLabel do
begin
Parent := WizardForm.SelectDirPage;
Left := ScaleX(0);
Top := ScaleY(220);
Width := ScaleX(209);
Height := ScaleY(13);
end;
ListBox:= TListBox.Create(WizardForm)
ListBox.SetBounds(WizardForm.DirEdit.Left, WizardForm.DirEdit.Top + WizardForm.DirEdit.Height + 8, WizardForm.DirBrowseButton.Left + WizardForm.DirBrowseButton.Width - WizardForm.DirEdit.Left, WizardForm.DiskSpaceLabel.Top - (WizardForm.DirEdit.Top + WizardForm.DirEdit.Height + 12))
ListBox.Font.Size:= 9
ListBox.Font.Style:= []
ListBox.Font.Name:= 'Courier New';
ListBox.OnClick:= @ObjectOnClick;
ListBox.Parent:= WizardForm.SelectDirPage;
WizardForm.DirEdit.OnChange := @GetFreeSpaceCaption;
WizardForm.DirEdit.Text := WizardForm.DirEdit.Text + #0;
end;

procedure CurPageChanged1(CurPageID: Integer);
begin
if CurPageID=wpSelectDir then
begin
GetNeedSpaceCaption;
if FreeMB < NeedSize then
WizardForm.NextButton.Enabled:=False
ListBoxRefresh
end;
end;

procedure InitializeWizard3();
begin
WizardForm.TYPESCOMBO.Visible:= false;
WizardForm.ComponentsList.Height := WizardForm.ComponentsList.Height + WizardForm.ComponentsList.Top - WizardForm.TYPESCOMBO.Top;
WizardForm.ComponentsList.Top := WizardForm.TYPESCOMBO.Top;
WizardForm.ComponentsList.Width := ScaleX(200);
InfoPanel := TPanel.Create(WizardForm);
InfoPanel.Parent := WizardForm.SelectComponentsPage;
InfoPanel.Caption := '';
InfoPanel.Top := WizardForm.ComponentsList.Top;
InfoPanel.Left := ScaleX(216);
InfoPanel.Width := ScaleX(200);
InfoPanel.Height := WizardForm.ComponentsList.Height;
InfoPanel.BevelInner := bvRaised;
InfoPanel.BevelOuter := bvLowered;
InfoCaption := TNewStaticText.Create(WizardForm);
InfoCaption.Parent := WizardForm.SelectComponentsPage;
InfoCaption.Caption := 'Описание';
InfoCaption.Left := ScaleX(224);
InfoCaption.Top := InfoPanel.Top - ScaleY(5);
InfoCaption.Font.Color := clActiveCaption;
Info := TNewStaticText.Create(WizardForm);
Info.Parent := InfoPanel;
Info.AutoSize := False;
Info.Left := ScaleX(6);
Info.Width := ScaleX(188);
Info.Top := ScaleY(12);
Info.Height := WizardForm.ComponentsList.Height - ScaleY(18);
Info.Caption := 'Переместите ваш указатель мыши на компоненты чтобы увидеть их описание.';
Info.WordWrap := true;
//Впишыте описание компонентов
enabledesc(WizardForm.ComponentsList.Handle,Info.Handle,
'Выберите язык внутриигрового текста;'+ //Text
'Немецкий текст;'+
'Испанский текст;'+
'Французский текст;'+
'Итальянский текст;'+
'Польский текст;'+
'Оригинальный, английский текст;'+ // Text\Englisch
'Выберите этот пункт, если вы хотите установить внутриигровую музыку. Учтите, что её можно отключить даже после инсталляции, в меню опций игры.;' // Music
);
end;



function ShouldSkipPage(CurPage: Integer): Boolean;
begin
if Pos('/SP-', UpperCase(GetCmdTail)) > 0 then
case CurPage of
wpLicense, wpPassword, wpInfoBefore, wpUserInfo,
wpSelectDir, wpSelectProgramGroup, wpInfoAfter:
Result := True;
end;
end;

const
WM_LBUTTONDOWN = 513;
WM_LBUTTONUP = 514;

procedure InitializeWizard4();
begin
if (Pos('/SP-', UpperCase(GetCmdTail)) > 0) then
begin
PostMessage(WizardForm.NextButton.Handle,WM_LBUTTONDOWN,0,0);
PostMessage(WizardForm.NextButton.Handle,WM_LBUTTONUP,0,0);
end;
end;

procedure CurPageChanged2(CurPageID: Integer);
begin
if (Pos('/SP-', UpperCase(GetCmdTail)) > 0) and
(CurPageID = wpSelectComponents) then
WizardForm.BackButton.Visible := False;
end;


//Проверка на оставшыеся файлы
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
Res: Integer;
begin
case CurUninstallStep of
usPostUninstall:
begin
if DirExists(ExpandConstant('{app}')) then
if ExpandConstant('{language}') = 'ua' then
case MsgBox('Папка "' + ExpandConstant('{app}') + '" не порожня.'#13#13 +
'"Так" – повне видалення всіх файлів у папці, включаючи саму папку.' #13#13 +
'"Ні" – відкрити папку в провіднику, щоб вручну видалити файли.'#13#13 +
'"Скасувати" – нічого не робити, видалити папку пізніше самостійно.', mbInformation, MB_YESNOCANCEL) of

IDYES:
if not DelTree(ExpandConstant('{app}'), True, True, True) then
MsgBox('Папка не видалена.' #13#13 'Папка або один з файлів у ній задіяні іншою програмою.', mbError, MB_OK);

IDNO:
if not ShellExec('open', ExpandConstant('{app}'), '', '', SW_SHOWMAXIMIZED, ewNoWait, Res) then
MsgBox('Помилка відкриття.' #13#13 'Папка не знайдена.', mbError, MB_OK);

IDCANCEL:;
end
else
if ExpandConstant('{language}') = 'ru' then
case MsgBox('Папка "' + ExpandConstant('{app}') + '" не пуста.'#13#13 +
'"Да" – полное удаление всех файлов в папке, включая саму папку.' #13#13 +
'"Нет" – открыть папку в проводнике, чтобы вручную удалить файлы.'#13#13 +
'"Отмена" – ничего не делать, удалить папку позже самостоятельно.', mbInformation, MB_YESNOCANCEL) of

IDYES:
if not DelTree(ExpandConstant('{app}'), True, True, True) then
MsgBox('Папка не удалена.' #13#13 'Папка или один из файлов в ней задействованы другим приложением.', mbError, MB_OK);

IDNO:
if not ShellExec('open', ExpandConstant('{app}'), '', '', SW_SHOWMAXIMIZED, ewNoWait, Res) then
MsgBox('Ошибка открытия.' #13#13 'Папка не найдена.', mbError, MB_OK);

IDCANCEL:;
end
else
case MsgBox('Directory "' + ExpandConstant('{app}') + '" is not empty.'#13#13 +
'"Yes" to delete all of the files in the directory, including the directory itself.' #13#13 +
'"No" to open the directory with explorer to delete the files manually.'#13#13 +
'"Cancel" to do nothing and delete the directory later manually.', mbInformation, MB_YESNOCANCEL) of

IDYES:
if not DelTree(ExpandConstant('{app}'), True, True, True) then
MsgBox('Directory is not deleted.' #13#13 'Directory or one of the files are used by the other application.', mbError, MB_OK);

IDNO:
if not ShellExec('open', ExpandConstant('{app}'), '', '', SW_SHOWMAXIMIZED, ewNoWait, Res) then
MsgBox('Error opening the directory.' #13#13 'Directory is not found.', mbError, MB_OK);

IDCANCEL:;
end
end
end
end;


function get_unique_random_number(X:byte):TRandNumbers;
var
A,b,c: string;
i,j,k:byte;
begin
For i:=1 to X do A:=A+chr(i);
B:='';
For i:=1 to X do begin
j:=Random(Length(A)-1)+1;
C:='';
B:=B + A[j];
for k:=1 to Length(A) do
if k<>j then C:=C+A[k];
A:=C;
end;
for i:=1 to X do Result[i]:=ord(B[i]);
end;

procedure OnTimer(HandleW, msg, idEvent, TimeSys: LongWord);
begin
currTime := currTime + 1;
if (currTime mod {#TIME_FOR_VIEW} = 0)
then begin
SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_'+inttostr(bmp[currTime/{#TIME_FOR_VIEW}])+'.bmp'));
if (currTime/{#TIME_FOR_VIEW} = N1) then currTime:=0;
end;
end;


procedure InitializeWizard5;
begin
bmp:=get_unique_random_number(N1);
ExtractTemporaryFile('Image_'+inttostr(bmp[1])+'.bmp');

currTime := 0;

WizardForm.ProgressGauge.Parent := WizardForm;
WizardForm.ProgressGauge.Top := WizardForm.CancelButton.Top + ScaleY(12);
WizardForm.ProgressGauge.Left := ScaleX(10);
WizardForm.ProgressGauge.Width := WizardForm.MainPanel.Width - ScaleX(20);
WizardForm.ProgressGauge.Height := 16;
WizardForm.ProgressGauge.Hide;

WizardForm.StatusLabel.Parent := WizardForm;
WizardForm.StatusLabel.Top := WizardForm.ProgressGauge.Top - ScaleY(18);
WizardForm.StatusLabel.Left := ScaleX(10);
WizardForm.StatusLabel.Width := ScaleX(397);
WizardForm.StatusLabel.Hide;

SplashImage := TBitmapImage.Create(WizardForm);
SplashImage.Top := 0;
SplashImage.Left := 0;
SplashImage.Width := WizardForm.MainPanel.Width;
SplashImage.Height := WizardForm.Bevel.Top;
SplashImage.Parent := WizardForm.InnerPage;
SplashImage.Stretch := True;
SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_'+inttostr(bmp[1])+'.bmp'));
SplashImage.Hide;
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssInstall then
begin
WizardForm.StatusLabel.Caption := 'Распаковка слайдов...';
for z:=2 to N1 do ExtractTemporaryFile('Image_'+inttostr(bmp[z])+'.bmp');
end;
if CurStep = ssPostInstall then begin
if (IsComponentSelected('VoiceD2\German') or IsComponentSelected('VoiceD2\Spanish') or IsComponentSelected('VoiceD2\French') or IsComponentSelected('VoiceD2\Italian') or IsComponentSelected('VoiceD2\Polish') or IsComponentSelected('VoiceD2\Russian') or IsComponentSelected('VoiceLoD\German') or IsComponentSelected('VoiceLoD\Spanish') or IsComponentSelected('VoiceLoD\French') or IsComponentSelected('VoiceLoD\Italian') or IsComponentSelected('VoiceLoD\Polish') or IsComponentSelected('VoiceLoD\Russian') ) then begin
ChangeCaption('Конвертация монологов...');
RecodeOgg;
end; //if IsComponentSelected
end; //CurStep = ssPostInstall
end;

procedure CurPageChanged3(CurPageID: Integer);
var
pfunc: LongWord;
begin
if (CurPageID = wpInstalling) then
begin
pfunc := WrapTimerProc(@OnTimer, 5);
TimerID := SetTimer(0, 0, 1000, pfunc);
WizardForm.PageNameLabel.Visible := False;
WizardForm.PageDescriptionLabel.Visible := False;
WizardForm.InnerNotebook.Hide;
WizardForm.Bevel1.Hide;
WizardForm.MainPanel.Hide;
WizardForm.PageNameLabel.Hide;
WizardForm.PageDescriptionLabel.Hide;
WizardForm.ProgressGauge.Show;
WizardForm.StatusLabel.Show;
SplashImage.Show;
WizardForm.CancelButton.Enabled := True;
WizardForm.CancelButton.Top := WizardForm.Bevel.Top + ScaleY(100);
end else
begin
WizardForm.ProgressGauge.Hide;
SplashImage.Hide;
WizardForm.FileNameLabel.Hide;
WizardForm.StatusLabel.Hide;
if (CurPageID > wpInstalling) and (CurPageID < wpFinished) then
begin
WizardForm.InnerNotebook.Show;
WizardForm.Bevel1.Show;
WizardForm.MainPanel.Show;
WizardForm.PageNameLabel.Show;
WizardForm.PageDescriptionLabel.Show;
end;
If CurPageID = wpFinished then
end;
end;


procedure CurPageChanged4(CurPageID: Integer);
begin
if CurPageID = wpInstalling then
WizardForm.BeveledLabel.hide;
if CurPageID = wpInfoAfter then
WizardForm.BeveledLabel.show;
end;




procedure InitializeWizard;
begin
InitializeWizard1();
InitializeWizard2();
InitializeWizard3();
InitializeWizard4();
InitializeWizard5();
end;


procedure CurPageChanged(CurPageID: Integer);
begin
CurPageChanged1(CurPageID);
CurPageChanged2(CurPageID);
CurPageChanged3(CurPageID);
CurPageChanged4(CurPageID);
end;

procedure DeinitializeSetup();
begin
disabledesc();
KillTimer(0, TimerID);
end;
этот "Автовыбор диска установки" (http://www.forum.oszone.ru/post-1217528-96.html), и этот Запрет русских символов в пути (http://forum.ru-board.com/topic.cgi?forum=5&topic=35848&start=1484&limit=1&m=2#1)?
Пожаааааалуйста http://i25.fastpic.ru/big/2011/0719/02/b3f16ceb30c04448d52500e216009302.gif http://i25.fastpic.ru/big/2011/0719/02/b3f16ceb30c04448d52500e216009302.gif http://i25.fastpic.ru/big/2011/0719/02/b3f16ceb30c04448d52500e216009302.gif
Первый код, этот тот тот же что я давал на предыдущей странице, только в этот встроен код конвертации OGG с прогресс-баром. Вот он: [C0de]
var
Files: Array of String;
S: String;
n: Integer;

Function StringToArray(Text, Cut: String): array of String; var i, k: Integer;
Begin
SetArrayLength(Result, 0); if Cut = '' then Cut:= #1310; //если шаблон пуст, считаем переводы строк
Repeat k:= Pos(Cut,Text);
if k = 1 then begin Delete(Text, 1, Length(Cut)); CONTINUE
end;
SetArrayLength(Result, GetArrayLength(Result) +1); i:= GetArrayLength(Result) -1;
if k = 0 then
Result[i]:=Text
else begin
Result[i]:= Copy(Text, 1, k -1); Delete(Text, 1, Length(Result[i]) + Length(Cut));
end;
Until Length(Text) * k = 0;
End;

procedure FindFiles(FromDir: String; Mask: String);
var FSR, DSR: TFindRec; FindResult: Boolean;
begin
FindResult:= FindFirst(AddBackslash(FromDir)+Mask, FSR)
while FindResult do begin
if FSR.Attributes and FILE_ATTRIBUTE_DIRECTORY = 0 then begin
S:= S + AddBackslash(fromDir) + FSR.Name +'|';
end;
FindResult:= FindNext(FSR);
end;
FindResult:= FindFirst(AddBackslash(FromDir)+ '*.*', DSR)
while FindResult do begin
if ((DSR.Attributes and FILE_ATTRIBUTE_DIRECTORY) = FILE_ATTRIBUTE_DIRECTORY) and not ((DSR.Name = '.') or (DSR.Name = '..')) then begin
FindFiles(AddBackSlash(FromDir)+DSR.Name, Mask)
end;
FindResult:= FindNext(DSR);
end;
FindClose(FSR); FindClose(DSR)
end;

procedure RecodeOgg;
var ResultCode: integer; CurFile: String;
begin
FindFiles(ExpandConstant('{app}'), '*.ogg') //Находим все файлы по маске, в выбранной папке
Files:= StringToArray(S, '|') //Переводим в массив
WizardForm.ProgressGauge.Max:= GetArrayLength(Files)-1; //Получаем кол-во файлов
WizardForm.ProgressGauge.Position:=0
for n:=(GetArrayLength(Files)-1) downto 0 do begin
CurFile:= Files[n]
StringChange(CurFile, AddBackslash(ExpandConstant('{app}')), '')
Exec(ExpandConstant('{app}\oggdec.exe'), '-Q '+AddQuotes(CurFile), '', SW_Hide, EwWaitUntilTerminated, ResultCode) //Для каждого файла запускаем декодер
DeleteFile(Files[n]) //Удаляем ненужный файл
WizardForm.FilenameLabel.Caption:= Files[n]; //Двигаем прогрессбар
WizardForm.ProgressGauge.Position:= WizardForm.ProgressGauge.Position +1;
end;
DeleteFile(ExpandConstant('{app}\oggdec.exe'))
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssPostInstall then RecodeOgg;
end;
Плиз, код с таким функционалом, для меня очень важен http://www.kolobok.us/smiles/light_skin/help.gif

Rikill
05-09-2011, 03:41
Raf-9600, как негры на тебя пашем
http://rghost.ru/20483881
не смог сюда текстом выложить ибо Òðåáóåòñÿ êàê ìèíèìóì

Devils Night
05-09-2011, 05:14
Есть вопрос, имеется скрипт авторана ->

[Setup]
AppName=AutoRUN
VersionInfoDescription=AutoRUN
VersionInfoProductName=AutoRUN
AppVerName=AutoRUN
CreateAppDir=no
OutputDir=.
OutputBaseFilename=Autorun

[Languages]
Name: Russian; MessagesFile: compiler:Default.isl

[Files]
Source: 1.bmp; Flags: dontcopy

[Messages]
SetupAppTitle=AutoRUN

[ Code]
const
BM_CLICK = $00F5;

var
AutoRun: TSetupForm;
img1: TBitmapImage;
PlayButton, InstallButton, SupportButton, ReadmeButton, WebButton, ExitButton, UninstallButton: TButton;
AppPath,UninsPath: string;
ResultCode: Integer;
procedure CurPageChanged(CurPageID: Integer);
begin
If CurPageID=wpWelcome then
SendMessage(WizardForm.NextButton.Handle, BM_CLICK, 0, 0);
end;

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

procedure PlayButtonClick(Sender: TObject);
var
exe: string;
begin
exe:='shift.exe';
if RegQueryStringValue(HKLM, 'SOFTWARE\Electronic Arts\Game','Install Dir', AppPath) then
begin
Exec(AddBackslash(AppPath) + Exe, '', ExtractFilePath(AddBackslash(AppPath) + Exe), SW_SHOWNORMAL,ewNoWait,ResultCode)
AutoRun.Close;
PostMessage(WizardForm.CancelButton.Handle, BM_CLICK, 0, 0);
end
end;

procedure InstallButtonClick(Sender: TObject);
var
CurPageID: Integer;
begin
Exec(ExpandConstant('{src}\Setup.exe'),'','',SW_SHOW,ewNoWait,ResultCode)
AutoRun.Close;
PostMessage(WizardForm.CancelButton.Handle, BM_CLICK, 0, 0);
end;

procedure SupportButtonClick(Sender: TObject);
begin
shellexec('open', ExpandConstant('{src}\Game.exe'), '', '',SW_SHOWNORMAL, ewnowait, ResultCode)
end;

procedure ReadmeButtonClick(Sender: TObject);
begin
ShellExec('open', ExpandConstant('{src}\readme.txt'),'','', SW_SHOW, ewNoWait, ResultCode)
end;

procedure WebButtonClick(Sender: TObject);
begin
shellexec('open', 'http://localhost', '', '',SW_SHOWNORMAL, ewnowait, ResultCode)
end;

procedure ExitButtonClick(Sender: TObject);
var
CurPageID: Integer;
begin
AutoRun.Close;
PostMessage(WizardForm.CancelButton.Handle, BM_CLICK, 0, 0);
end;

procedure UninstallButtonClick(Sender: TObject);
begin
if RegQueryStringValue(HKLM, 'SOFTWARE\Game','UninstallString', UninsPath) then
begin
UninsPath:=RemoveQuotes(UninsPath)
Exec(UninsPath,'','',SW_SHOWNORMAL,ewNoWait,ResultCode)
AutoRun.Close;
PostMessage(WizardForm.CancelButton.Handle, BM_CLICK, 0, 0);
end
end;

procedure CreateAutoRun;
begin
//AutoRun
AutoRun := CreateCustomForm;
with AutoRun do begin
Left := 498;
Top := 75;
Width := 495;
Height := 340;
BorderIcons := [];
BorderStyle:=bsToolWindow //(bsNone, bsSingle, bsSizeable, bsDialog, bsToolWindow, bsSizeToolWin)
Color := clBtnFace;
Font.Color := clWindowText;
Font.Height := -11;
Font.Name := 'MS Sans Serif';
Font.Style := [];
Position := poScreenCenter;
Caption:='AutoRUN'
end;
//img1
img1 := TBitmapImage.Create(AutoRun);
ExtractTemporaryFile('1.bmp');
with img1 do begin
Parent := AutoRun;
Left := 0;
Stretch:= true;
Top := 0;
Width := Autorun.Width;
Height := Autorun.Height;
Bitmap.LoadFromFile(ExpandConstant('{tmp}\1.bmp'));
end;
//PlayButton
PlayButton:= TButton.Create(AutoRun);
with PlayButton do begin
Parent := AutoRun;
Left := 300;
Top := 110;
Width := 150;
Height := 22;
Caption:= 'Íà÷àòü èãðó';
Cursor:= crHand;
// ModalResult:= mrOk;
OnClick := @PlayButtonClick;
if not RegQueryStringValue(HKLM, 'SOFTWARE\Game','Install Dir', AppPath) then
begin
PlayButton.Enabled := False;
end
end;
//InstallButton
InstallButton:= TButton.Create(AutoRun);
with InstallButton do begin
Parent:= AutoRun;
Left := 300;
Top := 80;
Width := 150;
Height := 22;
Caption:= 'Install Game';
Cursor:= crHand;
OnClick := @InstallButtonClick;
end;
//SupportButton
SupportButton:= TButton.Create(AutoRun);
with SupportButton do begin
Parent:= AutoRun;
Left := 300;
Top := 140;
Width := 150;
Height := 22;
Caption:= 'Èíôî';
Cursor:= crHand;
OnClick := @SupportButtonClick;
end;
//ReadmeButton
ReadmeButton:= TButton.Create(AutoRun);
with ReadmeButton do begin
Parent:= AutoRun;
Left := 300;
Top := 170;
Width := 150;
Height := 22;
Caption:= 'Readme';
Cursor:= crHand;
OnClick := @ReadmeButtonClick;
end;
//WebButton
WebButton:= TButton.Create(AutoRun);
with WebButton do begin
Parent:= AutoRun;
Left := 300;
Top := 200;
Width := 150;
Height := 22;
Caption:= 'Âåá-ñàéò';
Cursor:= crHand;
OnClick := @WebButtonClick;
end;
//ExitButton
ExitButton:= TButton.Create(AutoRun);
with ExitButton do begin
Parent:= AutoRun;
Left := 300;
Top := 260;
Width := 150;
Height := 22;
Caption:= 'Âûõîä';
Cursor:= crHand;
OnClick := @ExitButtonClick;
// ModalResult:= mrCancel;
end;
//UninstallButton
UninstallButton:= TButton.Create(AutoRun);
with UninstallButton do begin
Parent:= AutoRun;
Left := 300;
Top := 230;
Width := 150;
Height := 22;
Caption:= 'Óäàëèòü èãðó';
Cursor:= crHand;
OnClick := @UninstallButtonClick;
end;

if not RegQueryStringValue(HKLM, 'SOFTWARE\Game','UninstallString', UninsPath) then
begin
InstallButton.Enabled:=true;
UninstallButton.Enabled:=false;
end;
if RegQueryStringValue(HKLM, 'SOFTWARE\Game','UninstallString', UninsPath) then
begin
InstallButton.Enabled:=false;
UninstallButton.Enabled:=true;
end;

AutoRun.ShowModal;
end;

procedure InitializeWizard;
begin
CreateAutoRun;
end;



Так вот, есть три программы, точнее одна и две дополнительные, вопрос в следующем, как сделать так, чтобы в авторане было три галочки как в выборе компонентов, то что выбрано галочкой, то собственно и устанавливалось, да кстати, забыл главное, кнопка установить, должна быть одна, возможно ли такое?

valyok666
05-09-2011, 10:07
Devils Night, на пару примеров которые мне кидали (http://rghost.ru/20490571)

Raf-9600
05-09-2011, 10:55
Rikill, Спасибо огромное! Но у меня появилась небольшая проблема. После распаковки файлов, у меня ещё куча всего выполняется в [Run], на этот период я вызываю анимацию прогресс-бара через BeforeInstall: NeaProgress
procedure NeaProgress;
begin
WizardForm.ProgressGauge.Style:= npbstMarquee;
end;
После выполнения всех действий с [Run], должна запускаться конвертация OGG с обычным прогресс-баром (отображающим прогресс сего действия). Собстно проблема в том, что во время конвертации, прогресс-бар не меняется на обычный, а остается таким
WizardForm.ProgressGauge.Style:= npbstMarquee;
Это можно какнить исправить?

xXDx
05-09-2011, 12:44
Rikill, всмысле, например какими словами?




© OSzone.net 2001-2012