Автор: milwaukeeman
Дата сообщения: 18.11.2009 18:55
		Uterok 
  
 Пример с распаковкой с двух дисков  
 [more=ТУТ] 
 [Files]  
 Source: C:\FreeArc\bin\Arc.exe; DestDir: {tmp}; Flags: dontcopy  
  
 [CustomMessages]  
 ExtrError=Произошла ошибка во время извлечения данных. Установка будет прервана.  
 [Code]  
 var  
 SecondProgressBar: TNewProgressBar;  
  
 procedure InitializeWizard();  
 begin  
 WizardForm.FileNameLabel.Hide;  
 WizardForm.StatusLabel.Top:=ScaleY(81);  
 WizardForm.StatusLabel.Width:=WizardForm.InnerNotebook.Width;  
 WizardForm.StatusLabel.Width:=ScaleX(262);  
 WizardForm.ProgressGauge.Top:=ScaleY(100);  
 WizardForm.ProgressGauge.Left:=ScaleX(155);  
 WizardForm.ProgressGauge.Width:=ScaleX(262);  
  
 SecondProgressBar := TNewProgressBar.Create(WizardForm);  
 with SecondProgressBar do  
 begin  
 Parent := WizardForm.InstallingPage;  
 Left := ScaleX(0);  
 Top := ScaleY(100);  
 Width := ScaleX(150);  
 Height := ScaleY(21);  
 Min := 0;  
 Max := ..; //задается как (кол-во распаковываемых архивов * 3) + 1  
 end;  
 end;  
  
 procedure PlsInsertNextDisk(num: integer; CheckedFile: string);  
 var Capt:string;  
 begin  
 CheckedFile:=ExpandConstant(CheckedFile);  
 if not FileExists(CheckedFile) then begin  
 Capt:='Пожалуйста, вставьте диск %n, содержащий файл %f и нажмите ОК для продолжения установки.';  
 StringChange(Capt, '%n', inttostr(num));  
 StringChange(Capt, '%f', ExtractFileName(CheckedFile));  
 MsgBox(Capt, mbInformation, MB_OK);  
 PlsInsertNextDisk(num, CheckedFile);  
 end;  
 end;  
  
 procedure ExtractArc(arcArchName,arcDestDir:string);  
 var ResCode:integer;  
 begin  
 WizardForm.StatusLabel.Caption:=SetupMessage(msgStatusExtractFiles);  
 Exec(ExpandConstant('{tmp}\arc.exe'), 'x '+AddQuotes(ExpandConstant(arcArchName))+' -y -dp'+AddQuotes(ExpandConstant(arcDestDir)), '', SW_HIDE, ewWaitUntilTerminated, ResCode);  
 if (ResCode <> 0) then begin  
 MsgBox(ExpandConstant('{cm:ExtrError}'), mbCriticalError, MB_OK);  
 SecondProgressBar.Hide;  
 DelTree(ExpandConstant('{app}'), True, True, True);  
 Abort;  
 end else  
 SecondProgressBar.Position:= SecondProgressBar.Position+3  
 end;  
  
 procedure CurStepChanged(CurStep: TSetupStep);  
 begin  
 if CurStep = ssInstall then begin  
 WizardForm.StatusLabel.Caption:=SetupMessage(msgStatusExtractFiles);  
 ExtractTemporaryFile('arc.exe');  
 SecondProgressBar.Position:=SecondProgressBar.Position+1;  
  
 ExtractArc('{src}\data1.arc', '{app}');  
 ExtractArc('{src}\data2.arc', '{app}');  
 ExtractArc('{src}\data3.arc', '{app}');  
  
 PlsInsertNextDisk(2, '{src}\data4.arc'); //если data4.arc не найден в корне диска, просим второй диск  
 ExtractArc('{src}\data4.arc', '{app}');  
 ExtractArc('{src}\data5.arc', '{app}');  
 PlsInsertNextDisk(2, '{src}\data1.arc'); //снова просим первый диск  
 end;  
 end; 
 [/more]