Перейти из форума на сайт.

НовостиФайловые архивы
ПоискАктивные темыТоп лист
ПравилаКто в on-line?
Вход Забыли пароль? Первый раз на этом сайте? Регистрация
Компьютерный форум Ru.Board » Компьютеры » Программы » Inno Setup - создание инсталляционных пакетов (Часть 15)

Модерирует : gyra, Maz

 Версия для печати • ПодписатьсяДобавить в закладки
На первую страницук этому сообщениюк последнему сообщению

Открыть новую тему     Написать ответ в эту тему

marineharrison

Junior Member
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору

 
#define NeedSize "5000000000"
 
#define NeedMem 512
 
 
[Setup]
AppName=ISDone
AppVerName=ISDone
DefaultDirName={pf}\ISDone
DefaultGroupName=ISDone Example
OutputDir=.
OutputBaseFilename=Setup
VersionInfoCopyright=ProFrager
SolidCompression=yes
#ifdef NeedSize
ExtraDiskSpaceRequired={#NeedSize}
#endif
 
 
[Icons]
Name: {group}\Удалить пример ISDone; Filename: {app}\unins000.exe; WorkingDir: {app}; Check: CheckError
Name: {commondesktop}\Удалить пример ISDone; Filename: {app}\unins000.exe; WorkingDir: {app}; Check: CheckError
 
[Files]
Source: isSlideShow.dll; DestDir: {tmp}; Flags: dontcopy nocompression
Source: InnoCallback.dll; DestDir: {tmp}; Flags: dontcopy nocompression
Source: walls\BackImage.jpg; DestDir: "{tmp}"; Flags: dontcopy nocompression
Source: walls\01.jpg; DestDir: "{tmp}"; Flags: dontcopy nocompression
Source: iQuantum.cjstyles; DestDir: {tmp}; Flags: dontcopy nocompression
Source: ISSkin.dll; DestDir: {tmp}; Flags: dontcopy ignoreversion nocompression
 
Source: unarc.dll; DestDir: {tmp}; Flags: dontcopy ignoreversion nocompression
Source: ISDone.dll; DestDir: {tmp}; Flags: dontcopy ignoreversion nocompression
 
[Messages]
BeveledLabel=Aliens: Colonial Marines installer by ]^[@r!ne_I-I@rr!$0n
SelectDirDesc=В какую папку Вы хотите установить игру?
ReadyLabel1=Программа установки готова начать установку игры на Ваш компьютер.
InstallingLabel=Пожалуйста, подождите, пока игра установится на Ваш компьютер.
 
 
[CustomMessages]
russian.ExtractedFile=Извлекается файл:
russian.Extracted=Распаковка архивов...
russian.Error=Ошибка распаковки!
russian.ElapsedTime=Прошло:
russian.RemainingTime=Осталось времени:
russian.EstimatedTime=Всего:
russian.AllElapsedTime=Время установки:
 
[Languages]
Name: russian; MessagesFile: compiler:Languages\Russian.isl
 
[UninstallDelete]
Type: filesandordirs; Name: {app}
 
[Code]
const
  PCFonFLY=true;
  notPCFonFLY=false;
var
  LabelPct1,LabelCurrFileName,LabelTime1,LabelTime2,LabelTime3: TLabel;
  ISDoneProgressBar1: TNewProgressBar;
  ISDoneCancel:integer;
  ISDoneError:boolean;
  PCFVer:double;
 
  TimerID: LongWord;
  CurrentPicture:integer;
  PicList: TStringlist;
  BackgroundForm: TForm;
  PageNameLabel, PageDescriptionLabel: TLabel;  
 
 
type
  TCallback = function (OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAnsiChar): longword;
   
  TProc=procedure(HandleW, msg, idEvent, TimeSys: LongWord);
 
function WrapCallback(callback:TCallback; paramcount:integer):longword;external 'wrapcallback@files:ISDone.dll stdcall delayload';
function ISArcExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutPath, ExtractedPath: AnsiString; DeleteInFile:boolean; Password, CfgFile, WorkPath: AnsiString; ExtractPCF: boolean ):boolean; external 'ISArcExtract@files:ISDone.dll stdcall delayload';
function ShowChangeDiskWindow(Text, DefaultPath, SearchFile:AnsiString):boolean; external 'ShowChangeDiskWindow@files:ISDone.dll stdcall delayload';
function Exec2 (FileName, Param: PAnsiChar;Show:boolean):boolean; external 'Exec2@files:ISDone.dll stdcall delayload';
function ISFindFiles(CurComponent:Cardinal; FileMask:AnsiString; var ColFiles:integer):integer; external 'ISFindFiles@files:ISDone.dll stdcall delayload';
function ISPickFilename(FindHandle:integer; OutPath:AnsiString; var CurIndex:integer; DeleteInFile:boolean):boolean; external 'ISPickFilename@files:ISDone.dll stdcall delayload';
function ISGetName(TypeStr:integer):PAnsichar; external 'ISGetName@files:ISDone.dll stdcall delayload';
function ISFindFree(FindHandle:integer):boolean; external 'ISFindFree@files:ISDone.dll stdcall delayload';
function ISExec(CurComponent:Cardinal; PctOfTotal,SpecifiedProcessTime:double; ExeName,Parameters,TargetDir,OutputStr:AnsiString;Show:boolean):boolean; external 'ISExec@files:ISDone.dll stdcall delayload';
function FileSearchInit(RecursiveSubDir:boolean):boolean; external 'FileSearchInit@files:ISDone.dll stdcall delayload';
function ISDoneInit(RecordFileName:AnsiString; TimeType,Comp1,Comp2,Comp3:Cardinal; WinHandle, NeededMem:longint; callback:TCallback):boolean; external 'ISDoneInit@files:ISDone.dll stdcall';
function ISDoneStop:boolean; external 'ISDoneStop@files:ISDone.dll stdcall';
function SuspendProc:boolean; external 'SuspendProc@files:ISDone.dll stdcall';
function ResumeProc:boolean; external 'ResumeProc@files:ISDone.dll stdcall';
 
procedure LoadSkin(lpszPath: String; lpszIniFileName: String);  
external 'LoadSkin@files:isskin.dll stdcall';  
procedure UnloadSkin();  
external 'UnloadSkin@files:isskin.dll stdcall';
function ShowWindow(hWnd: Integer; uType: Integer): Integer;
external 'ShowWindow@user32.dll stdcall';  
 
function WrapTimerProc(callback:TProc; paramcount:integer):longword; external 'wrapcallback@files:innocallback.dll stdcall';
function SetTimer(hWnd, nIDEvent, uElapse, lpTimerFunc: LongWord): LongWord; external 'SetTimer@user32.dll stdcall';
function KillTimer(hWnd, nIDEvent: LongWord): LongWord; external 'KillTimer@user32.dll stdcall';
function GetSystemMetrics(nIndex:Integer):Integer; external 'GetSystemMetrics@user32.dll stdcall';
procedure InitializeSlideShow(Hwnd:Thandle; l,t,w,h:integer;Animate:boolean; Stretch:integer); external 'InitializeSlideShow@files:isslideshow.dll stdcall';
procedure DeinitializeSlideShow; external 'DeinitializeSlideShow@files:isslideshow.dll stdcall';
procedure ShowImage(ipath:PAnsiChar; Effect:integer); external 'ShowImage@files:isslideshow.dll stdcall';
 
function ProgressCallback(OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAnsiChar): longword;
begin
  if OveralPct<=1000 then ISDoneProgressBar1.Position := OveralPct;
  LabelPct1.Caption := IntToStr(OveralPct div 10)+'.'+chr(48 + OveralPct mod 10)+'%';
 
  LabelCurrFileName.Caption:=ExpandConstant('{cm:ExtractedFile} ')+MinimizePathName(CurrentFile, LabelCurrFileName.Font, LabelCurrFileName.Width-ScaleX(100));
  LabelTime1.Caption:=ExpandConstant('{cm:ElapsedTime} ')+TimeStr2;
  LabelTime2.Caption:=ExpandConstant('{cm:RemainingTime} ')+TimeStr1;
  LabelTime3.Caption:=ExpandConstant('{cm:AllElapsedTime}')+TimeStr3;
  Result := ISDoneCancel;
end;
 
procedure CancelButtonOnClick(Sender: TObject);
begin
  SuspendProc;
  if MsgBox(SetupMessage(msgExitSetupMessage), mbConfirmation, MB_YESNO) = IDYES then ISDoneCancel:=1;
  ResumeProc;
end;
 
procedure HideControls;
begin
  WizardForm.FileNamelabel.Hide;
  ISDoneProgressBar1.Hide;
  LabelPct1.Hide;
  LabelCurrFileName.Hide;
  LabelTime1.Hide;
  LabelTime2.Hide;        
end;
 
procedure CreateControls;
var PBTop:integer;
begin
  PBTop:=ScaleY(50);
  ISDoneProgressBar1 := TNewProgressBar.Create(WizardForm);
  with ISDoneProgressBar1 do begin
    Parent   := WizardForm.InstallingPage;
    Height   := WizardForm.ProgressGauge.Height;
    Left     := ScaleX(0);
    Top      := PBTop;
    Width    := ScaleX(365);
    Max      := 1000;
  end;
  LabelPct1 := TLabel.Create(WizardForm);
  with LabelPct1 do begin
    Parent    := WizardForm.InstallingPage;
    AutoSize  := False;
    Left      := ISDoneProgressBar1.Width+ScaleX(5);
    Top       := ISDoneProgressBar1.Top + ScaleY(2);
    Width     := ScaleX(80);
  end;
  LabelCurrFileName := TLabel.Create(WizardForm);
  with LabelCurrFileName do begin
    Parent   := WizardForm.InstallingPage;
    AutoSize := False;
    Width    := ISDoneProgressBar1.Width+ScaleX(30);
    Left     := ScaleX(0);
    Top      := ScaleY(30);
  end;
  LabelTime1 := TLabel.Create(WizardForm);
  with LabelTime1 do begin
    Parent   := WizardForm.InstallingPage;
    AutoSize := False;
    Width    := ISDoneProgressBar1.Width div 2;
    Left     := ScaleX(0);
    Top      := PBTop + ScaleY(35);
  end;
  LabelTime2 := TLabel.Create(WizardForm);
  with LabelTime2 do begin
    Parent   := WizardForm.InstallingPage;
    AutoSize := False;
    Width    := LabelTime1.Width+ScaleX(40);
    Left     := ISDoneProgressBar1.Width div 2;
    Top      := LabelTime1.Top;
  end;
  LabelTime3 := TLabel.Create(WizardForm);
  with LabelTime3 do begin
    Parent   := WizardForm.FinishedPage;
    AutoSize := False;
    Width    := 300;
    Left     := 180;
    Top      := 200;
  end;
  WizardForm.CancelButton.OnClick:=@CancelButtonOnClick;    
end;
 
procedure BevelLabelClick(Sender: TObject);  
var ErrorCode: Integer;  
begin  
ShellExec('open','http://vk.com/marine_harrison','', '', SW_SHOW, ewNoWait, ErrorCode)  
end;
 
function InitializeSetup(): Boolean;  
begin  
ExtractTemporaryFile('iQuantum.cjstyles');  
LoadSkin(ExpandConstant('{tmp}\iQuantum.cjstyles'), '');  
Result := True;  
end;  
 
procedure InitializeWizard();
begin
  BackgroundForm:= TForm.Create(nil);
  BackgroundForm.BorderStyle:= bsNone;
  BackgroundForm.Color:=clBlack;
  BackgroundForm.SetBounds(0, 0, GetSystemMetrics(0), GetSystemMetrics(1))
  BackgroundForm.Visible:=True;
  BackgroundForm.enabled:= false;
  PicList:=tstringlist.Create;
  ExtractTemporaryFile('BackImage.jpg');
  ExtractTemporaryFile('01.jpg');
  piclist.add(ExpandConstant('{tmp}') + '\01.jpg');
  BackgroundForm.show;
  InitializeSlideShow(BackgroundForm.Handle, 0, 0, GetSystemMetrics(0), GetSystemMetrics(1), false, 1);
  ShowImage(ExpandConstant('{tmp}') + '\BackImage.jpg', 1);
 
begin  
WizardForm.WizardBitmapImage.Width:=497  
WizardForm.WelcomeLabel1.Visible:=False  
WizardForm.WelcomeLabel2.Visible:=False  
WizardForm.WizardBitmapImage2.Width:=497  
WizardForm.FinishedLabel.Visible:=False  
WizardForm.FinishedHeadingLabel.Visible:=False
 
begin  
WizardForm.WizardSmallBitmapImage.SetBounds(ScaleX(0), ScaleY(0), WizardForm.MainPanel.Width, WizardForm.MainPanel.Height);  
 
begin  
PageNameLabel:= TLabel.Create(WizardForm);  
  with PageNameLabel do begin  
    Left:= WizardForm.PageNameLabel.Left;  
    Top:= WizardForm.PageNameLabel.Top;  
    Width:= WizardForm.PageNameLabel.Width;  
    Height:= WizardForm.PageNameLabel.Height;  
    AutoSize:= False;  
    WordWrap:= True;  
    Font.Name:= WizardForm.PageNameLabel.Font.Name;
    Font.Color:= clWhite;  
    Font.Style:= [fsBold];  
    Transparent:= True;  
    Parent:= WizardForm.MainPanel;  
  end;  
 
PageDescriptionLabel:= TLabel.Create(WizardForm);  
  with PageDescriptionLabel do begin  
    Left:= WizardForm.PageDescriptionLabel.Left-ScaleX(12);  
    Top:= WizardForm.PageDescriptionLabel.Top;  
    Height:= WizardForm.PageDescriptionLabel.Height;  
    Width:= ScaleX(220);  
    AutoSize:= False;  
    WordWrap:= True;  
    Font.Name:= WizardForm.PageDescriptionLabel.Font.Name;  
    Font.Color:= clWhite;
    Transparent:= True;  
    Parent:= WizardForm.MainPanel;  
  end;  
 
  with WizardForm do begin  
    PageNameLabel.Hide;  
    PageDescriptionLabel.Hide;
 
begin  
with WizardForm do begin  
with BeveledLabel do begin  
OnClick:=@BevelLabelClick;  
Font.Color:=clRed;  
Enabled:=True;  
Cursor:=crHand;  
end;  
end;  
end;  
 
end;  
end;
end;  
end;
end;
 
 
 
 
 
procedure OnTimer(HandleW, msg, idEvent, TimeSys: LongWord);
var
  thePicture: integer;
  delta: double;
begin
  delta := WizardForm.ProgressGauge.Max / ( piclist.Count );
  thePicture := round( WizardForm.ProgressGauge.Position / delta );
  if( thePicture <> CurrentPicture  ) then
   begin
    CurrentPicture := thePicture;
    try
      ShowImage(piclist.strings[CurrentPicture - 1], 1);
    except
    end;
   end;
end;
 
 
 
 
Procedure CurPageChanged(CurPageID: Integer);
Begin
  if (CurPageID = wpFinished) and ISDoneError then
  begin
    LabelTime3.Hide;
    WizardForm.Caption:= ExpandConstant('{cm:Error}');
    WizardForm.FinishedLabel.Font.Color:= clRed;
    WizardForm.FinishedLabel.Caption:= SetupMessage(msgSetupAborted) ;
 
begin  
PageNameLabel.Caption:= WizardForm.PageNameLabel.Caption;  
PageDescriptionLabel.Caption:= WizardForm.PageDescriptionLabel.Caption;
begin  
  If CurPageID=wpInstalling then  
 begin
     
   WizardForm.MainPanel.Visible:=False;  
   WizardForm.Bevel1.Visible:=False;  
   WizardForm.Width:=ScaleX(395);  
   WizardForm.Height:=ScaleY(142);
     
   WizardForm.Position:=poScreenCenter;
   WizardForm.Top:=ScaleY(BackgroundForm.Height-170);
   
   WizardForm.InnerNotebook.Left:=ScaleX(10);  
   WizardForm.InnerNotebook.Top:=ScaleY(10);  
   WizardForm.InnerNotebook.Width:=ScaleX(370);  
   WizardForm.StatusLabel.Left:=ScaleX(0);  
   WizardForm.StatusLabel.Top:=ScaleY(0);  
   WizardForm.StatusLabel.Width:=WizardForm.InnerNotebook.Width;  
   WizardForm.FileNameLabel.Left:=ScaleX(0);  
   WizardForm.FileNameLabel.Top:=ScaleY(20);  
   WizardForm.FileNameLabel.Width:=WizardForm.InnerNotebook.Width;  
   WizardForm.ProgressGauge.Top:=ScaleY(40);  
   WizardForm.ProgressGauge.Width:=WizardForm.InnerNotebook.Width;  
   WizardForm.CancelButton.Left:=ScaleX(154);  
   WizardForm.CancelButton.Top:=ScaleY(80);
   WizardForm.CancelButton.bringtofront;
 
  TimerID:=SetTimer(0, 0, 200, WrapTimerProc(@OnTimer, 4));
end;
end;  
 
if CurPageID=wpFinished then  
  begin  
    WizardForm.Visible:=False;  
    WizardForm.Width:=502;  
    WizardForm.Height:=392;  
    WizardForm.Left:=(BackgroundForm.Width-WizardForm.Width) div 2;  
    WizardForm.Top:=(BackgroundForm.Height-WizardForm.Height) div 2;  
    WizardForm.Visible:=True;  
    showimage(ExpandConstant('{tmp}') + '\BackImage.jpg', 1);
  end;  
end;
 
end;
end;
 
function CheckError:boolean;
begin
  result:= not ISDoneError;
end;
 
procedure CurStepChanged(CurStep: TSetupStep);
var Comps1,Comps2,Comps3, TmpValue:cardinal;
    FindHandle1,ColFiles1,CurIndex1,tmp:integer;
    ExecError:boolean;
    InFilePath,OutFilePath,OutFileName:PAnsiChar;
begin
  if CurStep = ssInstall then begin  //Если необходимо, можно поменять на ssPostInstall
    WizardForm.ProgressGauge.Hide;
    CreateControls;
    WizardForm.StatusLabel.Caption:=ExpandConstant('{cm:Extracted}');
    ISDoneCancel:=0;
 
// Распаковка всех необходимых файлов в папку {tmp}.
 
ExtractTemporaryFile('unarc.dll');
 
// Подготавливаем переменную, содержащую всю информацию о выделенных компонентах для ISDone.dll
// максимум 96 компонентов.
    Comps1:=0; Comps2:=0; Comps3:=0;
 
  ISDoneError:=true;
if ISDoneInit(ExpandConstant('{src}\records.inf'), $F777, Comps1,Comps2,Comps3, MainForm.Handle, {#NeedMem}, @ProgressCallback) then begin
  repeat
    if not FileSearchInit(false) then break;
 
    if not ISArcExtract ( 0, 50, ExpandConstant('{src}\setup-1.arc'), ExpandConstant('{app}'), '', false, '', '', '', notPCFonFLY) then break;
 
    if not ShowChangeDiskWindow('Пожалуйста, вставьте диск 2 и дождитесь его инициализации.', ExpandConstant('{src}'),'setup-2.arc') then break;
 
    if not ISArcExtract ( 0, 50, ExpandConstant('{src}\setup-2.arc'), ExpandConstant('{app}'), '', false, '', '', '', notPCFonFLY) then break;
 
    ISDoneError:=false;
  until true;
  ISDoneStop;
end;
 
 
    HideControls;
    WizardForm.CancelButton.Visible:=true;
    WizardForm.CancelButton.Enabled:=false;
  end;
  if (CurStep=ssPostInstall) and ISDoneError then begin
    Exec2(ExpandConstant('{uninstallexe}'), '/VERYSILENT', false);
  end;
end;
 
procedure DeinitializeSetup();
begin
DeinitializeSlideShow;
KillTimer(0, TimerID);
ShowWindow(StrToInt(ExpandConstant('{wizardhwnd}')), 0);
UnloadSkin();  
end;
 
 

Всего записей: 93 | Зарегистр. 10-08-2009 | Отправлено: 22:55 28-03-2014
Открыть новую тему     Написать ответ в эту тему

На первую страницук этому сообщениюк последнему сообщению

Компьютерный форум Ru.Board » Компьютеры » Программы » Inno Setup - создание инсталляционных пакетов (Часть 15)


Реклама на форуме Ru.Board.

Powered by Ikonboard "v2.1.7b" © 2000 Ikonboard.com
Modified by Ru.B0ard
© Ru.B0ard 2000-2024

BitCoin: 1NGG1chHtUvrtEqjeerQCKDMUi6S6CG4iC

Рейтинг.ru