AngelDead
Junior Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору #define AppRunningFile "{app}\Bully.exe" ;Путь к файлу, который запускается после установки ;Пути к файлам или ссылки, которые будут отображаться в GameExplorer'е #define precomp GetEnv("ProgramFiles") + "\FreeArc\PowerPack\Max\*" ;если архивы созданы с PRECOMP, раскомментируйте строку и укажите папку с необходимыми для распаковки файлами (в общем случае это precomp04.exe, PPMonstr.exe, ecm.exe, unecm.exe, packjpg_dll.dll) [Setup] AppId={{7686A7D7-0180-462E-8EBB-77F1EF04F9D3} AppName=Bully Scholarship Edition AppVerName=Bully Scholarship Edition AppPublisher=Rockstar Games AppVersion=1.0.1 DefaultDirName={pf}\Rockstar Games\Bully Scholarship Edition OutputDir=E:\Репаки\Bully Scholarship Edition DefaultGroupName=Bully Scholarship Edition UninstallFilesDir={app}\Uninstall Compression=lzma/ultra64 InternalCompressLevel=ultra64 SolidCompression=true DiskSpanning=yes SlicesPerDisk=3 DiskSliceSize=1100000000 DisableProgramGroupPage=true SetupIconFile=C:\Users\Кирилл\Desktop\Bully_1.ico DisableReadyPage=true UninstallDisplayIcon={app}\Bully.exe, 0 UninstallDisplayName=Bully Scholarship Edition VersionInfoDescription=Compiled by AngelDead VersionInfoVersion=1.0.1.0.0 [Languages] Name: RUS; MessagesFile: compiler:Languages\Russian.isl [Icons] Name: "{group}\Запустить игру"; Filename: {#AppRunningFile}; WorkingDir: "{app}"; Check: GroupIcons; Name: "{group}\Удалить игру"; Filename: {uninstallexe}; WorkingDir: {app}; Check: GroupIcons; ;Этот ярлык создается на Рабочем столе Name: "{userdesktop}\{#SetupSetting("AppName")}"; Filename: {#AppRunningFile}; WorkingDir: {app}; Check: CreateIcons; [_ISToolPreCompile] #sub ShowErr #pragma error Str(void) #endsub #define Break(any S = "Empty") void = S, ShowErr #ifndef Archives #define Archives "" #endif #define LastLine #define Current AddBackslash(GetEnv("TEMP")) + GetDateTimeString('dd/mm-hh:nn', '-', '-') +'.iss' #sub GetLastLine #expr SaveToFile(Current) #for {faAnyFile = FileOpen(Current); !FileEof(faAnyFile); LastLine = FileRead(faAnyFile)} NULL #expr FileClose(faAnyFile) #endsub #define TrimEx(str S = "", str T = " ") \ Pos(T,S) == 1 ? S = Copy(S,2,Len(S)) : S, Copy(S,Len(S)) == T ? S = Copy(S,1,Len(S)-1) : S, Pos(T,S) == 1 || Copy(S,Len(S)) == T ? TrimEx(S,T) : S #define SkipText(str S = "", str T = ";", int F = 1) \ Local[0] = Pos(T, S), Local[0] > 0 ? (F == 0 ? Copy(S, Local[0]) : (F < 0 ? Copy(S,,Local[0] -1) : Copy(S, Local[0] + Len(T)))) : S #define Find2Cut(str S, str B, str E = ";") \ S = LowerCase(S), B = LowerCase(B), \ (Local[0] = Pos(B, S)) > 0 ? (Local[1] = Copy(S, Local[0]+Len(B)), (Local[0] = Pos(E, Local[1])) > 0 ? (Copy(Local[1],, Local[0]-1)) : Local[1]) : "" #define SourceToProgress() GetLastLine, \ Local[0] = Find2Cut(LastLine,"UnArc(",")"), Local[0] == "" ? Local[0] = Find2Cut(LastLine,"UnZip(",")") : void, Local[0] != "" && Pos("dontcopy", Find2Cut(LastLine,"Flags:")) == 0 ? Local[5] = "?" : void, \ Local[1] = TrimEx(TrimEx(SkipText(Local[0],"',",-1)),"'"), Local[2] = TrimEx(TrimEx(SkipText(Local[0],"',")),"'"), Local[1] == "" ? Local[1] = TrimEx(Find2Cut(LastLine,"Source:")) : void, Local[2] == "" ? Local[2] = TrimEx(Find2Cut(LastLine,"DestDir:")) : void, \ Local[3] = TrimEx(Find2Cut(LastLine,"Components:")), Local[3] == "" ? void : (Local[3] = "<"+ Local[3], void), Local[4] = TrimEx(Find2Cut(LastLine,"Tasks:")), Local[4] == "" ? void : (Local[4] = ">"+ Local[4], void), \ Local[1] == "" ? Break('Previous line must be in [Files] section') : (Local[0] = Local[1] +"/"+ Local[2] + Local[3] + Local[4] + Local[5]), TrimEx(Archives) == "" ? Archives = Local[0] : (Archives = Archives +"|"+ Local[0]), void #define isFalse(any S) (S = LowerCase(Str(S))) == "no" || S == "false" || S == "off" ? "true" : "false" [Files] Source: C:\Program Files (x86)\Codejock Software\ISSkin\ISSkin.dll; DestDir: {app}; Flags: dontcopy Source: C:\Users\Кирилл\Desktop\Tiger.cjstyles; DestDir: {tmp}; Flags: dontcopy Source: C:\Users\Кирилл\Desktop\8.bmp; DestDir: {tmp}; Flags: dontcopy; Source: "E:\Новая папка\*"; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs ;Функция FilenameExt() отображает файлы, которые в данный момент извлекаются, добавьте эту функцию ко всем файлам, которые должны инсталлироваться Source: F:\Флэш-дистр\Inno Setup\FreeArc4InnoSetup3_4\unarc.dll; DestDir: {tmp}; Flags: dontcopy Source: F:\Флэш-дистр\Inno Setup\FreeArc4InnoSetup3_4\InnoCallback.dll; DestDir: {tmp}; Flags: dontcopy #ifdef precomp ;если указано, что архивы созданы с PRECOMP, в инсталлятор включаются необходимые при распаковке файлы Source: {#precomp}; DestDir: {sys}; Flags: deleteafterinstall Source: {#GetEnv("ProgramFiles")}\FreeArc\bin\arc.ini; DestDir: c:\; Flags: deleteafterinstall #endif ;эта строка демонстрирует показ сведений и времени завершения при обычном извлечении файлов Source: {win}\help\*.hlp; DestDir: {app}\Files; Flags: external ;строки распаковки архивов Source: {src}\bin\audio.arc; DestDir: {app}; Flags: external dontcopy {#SourceToProgress} Source: {src}\bin\Stream.arc; DestDir: {app}; Flags: external dontcopy {#SourceToProgress} Source: C:\Users\Кирилл\Desktop\isgsg.dll; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression Source: C:\Users\Кирилл\Desktop\bass.dll; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression Source: "C:\Users\Кирилл\Desktop\sound.mp3"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression Source: "C:\Users\Кирилл\Desktop\MusicButton.bmp"; DestDir: "{tmp}"; Flags: dontcopy [Registry] Root: HKLM; SubKey: SOFTWARE\Rockstar Games\Bully Scholarship Edition; ValueType: dword; ValueName: Language; ValueData: $00000419 Root: HKLM; SubKey: SOFTWARE\Rockstar Games\Bully Scholarship Edition; ValueType: string; ValueName: SerialNum; ValueData: 0000-0000-0000-0000 Root: HKLM; SubKey: SOFTWARE\Rockstar Games\Bully Scholarship Edition; ValueType: string; ValueName: Version; ValueData: 1.00.0154 [CustomMessages] RUS.SPACE=Доступно места на диске: RUS.SPACE1=Требуется места на диске: RUS.DirectX=Обновить DirectX RUS.DirectXInstall=Идет обновление DirectX... RUS.Icons=Создать ярлык на рабочем столе RUS.Group=Создать ярлыки в меню "Пуск" RUS.Redist=Установить Microsoft C++ Redist RUS.RedistInstall=Идет установка Microsoft Visual C++ Redistibutable RUS.Finished1=Игра {#SetupSetting("AppName")} установлена на Ваш компьютер. RUS.Finished2=Нажмите «Завершить», чтобы выйти из программы установки. RUS.RunProgram=Запустить {#SetupSetting("AppName")} RUS.TasksLabel1=Дополнительные значки: RUS.TasksLabel2=Установка дополнительных программ: RUS.ArcError=Распаковщик FreeArc вернул код ошибки: %1 RUS.ArcBroken=Возможно, архив <%1> повреждён или недостаточно места на диске назначения. ;rus.PassFail=Неверный пароль! RUS.ArcFail=Распаковка не завершена! RUS.ArcTitle=Распаковка игровых архивов... ;rus.Szip=Распаковка 7zip-архивов... RUS.StatusInfo=файлов: %1%2, %3%% выполнено, осталось ждать %4 RUS.ArcInfo=Архив %1 из %2, объём %3 из %5, %4%% обработано RUS.ArcFinish=Распаковано архивов: %1, получено файлов: %2 [%3] RUS.taskbar=%1%%, %2 remains RUS.taskbar=%1%%, жди %2 RUS.ending=завершение RUS.hour=часов RUS.min=мин RUS.sec=сек ;GameDescription показывет описание игры в GameExplore'е, описание нужно вписывать самому [Code] const Indent=10; BASS_ACTIVE_PLAYING = 1; BASS_ACTIVE_STALLED = 2; BASS_ACTIVE_PAUSED = 3; BASS_SAMPLE_LOOP = 4; //Эти данные нужны для создания надписей, при вставке изображения в инстяллятор var DirectX, Redist, Icons, Group, RunProgram: TCheckBox; //Чекбоксы IconsLabel, GroupLabel, RedistLabel, DirectXLabel: TLabel; //Надписи к чекбоксам SelectDirLabel, SelectDirLabelBrowse, RunProgramLabel: TLabel; //Надписи на странице выбора места установки PageNameLabel, PageNameLabel1, PageNameLabel2, PageNameLabel3, PageNameLabel4, PageNameLabel5, PageNameLabel6, PageNameLabel7, PageNameLabel8: TLabel; //Заголовок страницы PageDescriptionLabel, PageDescriptionLabel1, PageDescriptionLabel2, PageDescriptionLabel3, PageDescriptionLabel4, PageDescriptionLabel5, PageDescriptionLabel6, PageDescriptionLabel7, PageDescriptionLabel8: TLabel; //Информация о странице StatusLabel, FilenameLabel, NeedSpaceLabel,FreeSpaceLabel: TLabel; //Данные на страниые установки WelcomeLabel1, WelcomeLabel2,FinishedLabel, FinishedHeadingLabel: TLabel; //Надписи на на странице приветствия и на финишной странице SelectStartMenuFolderLabel, SelectStartMenuFolderBrowseLabel, ReadyLabel, NoIconsLabel: TLabel; //Надписи и чекбоксы на странице выбора места установки ярлыков в Главном Меню LicenseLabel1, LicenseAcceptedLabel, LicenseNotAcceptedLabel: Tlabel; //Надписи на страниые Лицензионнго соглашения InfoBeforeClickLabel, InfoAfterClickLabel, ComponentsDiskSpaceLabel, SelectComponentsLabel: TLabel; //Надписи на странице компонентов и страницах показа данных до и после установки NeedSize:Integer; //Нужное место на диске FreeMB, TotalMB: Cardinal; //нужное место на диске BmpFile: TBitmapImage; //Вставка изобрпжения в окно инсталлятора PageID,ResultCode: Integer; //Запуск программы после установки UpBevel, DownBevel: TBevel; BeveledLabel: TLabel; //Страница дополнительных задач TasksPage: TWizardPage; SelectTasksLabel, TasksLabel1, TasksLabel2: TLabel; mp3Handle: HWND; mp3Name: String; PlayButton, PauseButton, StopButton: TPanel; PlayImage, PauseImage: TBitmapImage; PlayLabel, PauseLabel: TLabel; MouseLabel: Tlabel; Function NumToStr(Float: Extended): String; Begin Result:= Format('%.2n', [Float]); StringChange(Result, ',', '.'); while ((Result[Length(Result)] = '0') or (Result[Length(Result)] = '.')) and (Pos('.', Result) > 0) do SetLength(Result, Length(Result)-1); End; //Дальше функция проверки чекбоксов function InstallDirectX: Boolean; begin Result:= DirectX.Checked; end; function InstallRedist: Boolean; begin Result:=Redist.Checked; end; function CreateIcons: Boolean; begin Result:=Icons.Checked; end; function GroupIcons: Boolean; begin Result:=Group.Checked; end; function Run: Boolean; begin Result:=RunProgram.Checked; end; function BASS_Init(device: Integer; freq, flags: DWORD; win: hwnd; CLSID: Integer): Boolean; external 'BASS_Init@files:BASS.dll stdcall delayload'; function BASS_StreamCreateFile(mem: BOOL; f: PChar; offset: DWORD; length: DWORD; flags: DWORD): DWORD; external 'BASS_StreamCreateFile@files:BASS.dll stdcall delayload'; function BASS_Start(): Boolean; external 'BASS_Start@files:BASS.dll stdcall delayload'; function BASS_ChannelPlay(handle: DWORD; restart: BOOL): Boolean; external 'BASS_ChannelPlay@files:BASS.dll stdcall delayload'; function BASS_ChannelIsActive(handle: DWORD): Integer; external 'BASS_ChannelIsActive@files:BASS.dll stdcall delayload'; function BASS_ChannelPause(handle: DWORD): Boolean; external 'BASS_ChannelPause@files:BASS.dll stdcall delayload'; function BASS_Pause(): Boolean; external 'BASS_Pause@files:BASS.dll stdcall delayload'; function BASS_Free(): Boolean; external 'BASS_Free@files:BASS.dll stdcall delayload'; //Функция проверки чекбоксов // задал процедуру, чтоб отмечался чебокс еси кликнуть по надписи procedure RedistOnClick(Sender: TObject); begin if Redist.Checked = False then Redist.Checked:= True else Redist.Checked:= False; end; procedure DirectXLabelOnClick(Sender: TObject); begin if DirectX.Checked = False then DirectX.Checked:= True else DirectX.Checked:= False; end; procedure IconsOnClick(Sender: TObject); begin if Icons.Checked = False then Icons.Checked:= True else Icons.Checked:= False; end; procedure GroupOnClick(Sender: TObject); begin if Group.Checked = False then Group.Checked:= True else Group.Checked:= False; end; procedure RunProgramOnClick(Sender: TObject); begin if RunProgram.Checked = False then RunProgram.Checked:= True else RunProgram.Checked:= False; end; Procedure NoIconsLabelOnClick (Sender: TObject); begin WizardForm.NoIconsCheck.Checked:=Not(WizardForm.NoIconsCheck.Checked) end; procedure LicenceAcceptedRadioOnClick(Sender: TObject); begin WizardForm.NextButton.Enabled:=True end; procedure LicenceNotAcceptedRadioOnClick(Sender: TObject); begin WizardForm.NextButton.Enabled:=False end; Procedure YesRadioOnClick (Sender: TObject); begin WizardForm.LicenseAcceptedRadio.Checked:=True end; Procedure NoRadioOnClick (Sender: TObject); begin WizardForm.LicenseNotAcceptedRadio.Checked:=True end; procedure PlayMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin PlayImage.Left := -100 end; procedure PlayMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin PlayImage.Left := 4 end; procedure PlayMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); begin if PlayImage.Left <> -100 then PlayImage.Left := -196 end; procedure PauseMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin PauseImage.Left := -132 end; procedure PauseMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin PauseImage.Left := -36 end; procedure PauseMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); begin if PauseImage.Left <> -132 then PauseImage.Left := -228 end; procedure MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); begin PlayImage.Left := -4 PauseImage.Left := -36 end; // задал процедуру, чтоб отмечался чебокс еси кликнуть по надписи lblCheckBox //Свободное место, отображает сколько нужно и сколько есть места на диске, находтся на странице выбора пути procedure GetFreeSpaceCaption(Sender: TObject); var Path: String; begin Path := ExtractFileDrive(WizardForm.DirEdit.Text); GetSpaceOnDisk(Path, True, FreeMB, TotalMB); if FreeMB > 1024 then FreeSpaceLabel.Caption := ExpandConstant('{cm:SPACE} ')+ NumToStr(round(FreeMB/1024*100)/100) + ' GB' else FreeSpaceLabel.Caption := ExpandConstant('{cm:SPACE} ')+ IntToStr(FreeMB)+ ' MB'; if FreeMB < NeedSize then WizardForm.NextButton.Enabled := False else WizardForm.NextButton.Enabled := True; end; procedure GetNeedSpaceCaption; begin if NeedSize > 1024 then NeedSpaceLabel.Caption := ExpandConstant('{cm:SPACE1} ')+ NumToStr(round(NeedSize/1024*100)/100) + ' GB' else NeedSpaceLabel.Caption := ExpandConstant('{cm:SPACE1} ')+ IntToStr(NeedSize)+ ' MB'; end; //Свободное место procedure FilenameExt(); begin FilenameLabel.Caption:= ExpandConstant(ExtractFileDir(CurrentFilename)) + '\' + ExtractFilename(CurrentFilename); end; //Загрузка скина 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 InitializeSetup(): Boolean; begin ExtractTemporaryFile('Tiger.cjstyles'); LoadSkin(ExpandConstant('{tmp}\Tiger.cjstyles'), ''); ExtractTemporaryFile('BASS.dll'); ExtractTemporaryFile('sound.mp3'); mp3Name := ExpandConstant('{tmp}\sound.mp3'); BASS_Init(-1, 44100, 0, 0, 0); mp3Handle := BASS_StreamCreateFile(FALSE, PChar(mp3Name), 0, 0, BASS_SAMPLE_LOOP); BASS_Start(); BASS_ChannelPlay(mp3Handle, False) Result := True; end; procedure PlayButtonOnClick(Sender: TObject); begin case BASS_ChannelIsActive(mp3Handle) of BASS_ACTIVE_PAUSED: begin BASS_ChannelPlay(mp3Handle, False); PlayButton.Hide PauseButton.Show end; end; end; procedure PauseButtonOnClick(Sender: TObject); begin BASS_ChannelPause(mp3Handle); PauseButton.Hide PlayButton.Show end; procedure InitializeWizard1(); begin ExtractTemporaryFile('8.bmp'); //Извлекаем файл, который пойдет в окно инсталлятора ExtractTemporaryFile('MusicButton.bmp') NeedSize:= 3900; //Необходимое место для установки //Необходимое место для установки TasksPage := CreateCustomPage(wpSelectProgramGroup, 'Выберите дополнительные задачи', 'Какие дополнительные задачи необходимо выполнить?'); //Вставляем изображение в окно инсталлятора, для каждой страницы нужно добвлять изображение заново BmpFile:= TBitmapImage.Create(WizardForm); BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\8.bmp')); BmpFile.SetBounds(0, 0, 497, 360); BmpFile.Stretch:= true BmpFile.Parent:= WizardForm.WelcomePage; BmpFile:= TBitmapImage.Create(WizardForm); BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\8.bmp')); BmpFile.SetBounds(0, 0, 497, 360); BmpFile.Stretch:= true BmpFile.Parent:= WizardForm.LicensePage; BmpFile:= TBitmapImage.Create(WizardForm); BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\8.bmp')); BmpFile.SetBounds(0, 0, 497, 360); BmpFile.Stretch:= true BmpFile.Parent:= WizardForm.InfoBeforePage; BmpFile:= TBitmapImage.Create(WizardForm); BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\8.bmp')); BmpFile.SetBounds(0, 0, 497, 360); BmpFile.Stretch:= true BmpFile.Parent:= WizardForm.SelectDirPage; BmpFile:= TBitmapImage.Create(WizardForm); BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\8.bmp')); BmpFile.SetBounds(0, 0, 497, 360); BmpFile.Stretch:= true BmpFile.Parent:= WizardForm.SelectComponentsPage; BmpFile:= TBitmapImage.Create(WizardForm); BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\8.bmp')); BmpFile.SetBounds(0, 0, 497, 360); BmpFile.Stretch:= true BmpFile.Parent:= WizardForm.SelectProgramGroupPage; BmpFile:= TBitmapImage.Create(TasksPage); BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\8.bmp')); BmpFile.SetBounds(0, 0, 497, 360); BmpFile.Stretch:= true BmpFile.Parent:= TasksPage.Surface; BmpFile:= TBitmapImage.Create(WizardForm); BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\8.bmp')); BmpFile.SetBounds(0, 0, 497, 360); BmpFile.Stretch:= true BmpFile.Parent:= WizardForm.ReadyPage; BmpFile:= TBitmapImage.Create(WizardForm); BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\8.bmp')); BmpFile.SetBounds(0, 0, 497, 360); BmpFile.Stretch:= true BmpFile.Parent:= WizardForm.InstallingPage; BmpFile:= TBitmapImage.Create(WizardForm); BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\8.bmp')); BmpFile.SetBounds(0, 0, 497, 360); BmpFile.Stretch:= true BmpFile.Parent:= WizardForm.InfoAfterPage; BmpFile:= TBitmapImage.Create(WizardForm); BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\8.bmp')); BmpFile.SetBounds(0, 0, 497, 360); BmpFile.Stretch:= true BmpFile.Parent:= WizardForm.FinishedPage; MouseLabel := TLabel.Create(WizardForm) MouseLabel.Width := WizardForm.Width MouseLabel.Height := WizardForm.Height MouseLabel.Autosize := False MouseLabel.Transparent := True MouseLabel.OnMouseMove := @MouseMove MouseLabel.Parent := WizardForm PlayButton := TPanel.Create(WizardForm) PlayButton.Left := 468 PlayButton.Top := 5 PlayButton.Width := 25 PlayButton.Height := 23 PlayButton.Cursor := crHand PlayButton.ShowHint := True PlayButton.Hint := 'Воспроизведение музыки' PlayButton.OnClick := @PlayButtonOnClick PlayButton.Parent := WizardForm PlayImage := TBitmapImage.Create(WizardForm) PlayImage.Left := 0 PlayImage.Top := 0 PlayImage.Width := 288 PlayImage.Height := 23 PlayImage.Enabled := False PlayImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\MusicButton.bmp')) PlayImage.Parent := PlayButton // PlayImage.ReplaceColor:=$E2E2E2 PlayImage.ReplaceWithColor:=clBtnFace PlayLabel := TLabel.Create(WizardForm) PlayLabel.Width := PlayButton.Width PlayLabel.Height := PlayButton.Height PlayLabel.Autosize := False PlayLabel.Transparent := True PlayLabel.OnClick := @PlayButtonOnClick PlayLabel.OnMouseDown := @PlayMouseDown PlayLabel.OnMouseUp := @PlayMouseUp PlayLabel.OnMouseMove := @PlayMouseMove PlayLabel.Parent := PlayButton PauseButton := TPanel.Create(WizardForm) PauseButton.Left := 468 PauseButton.Top := 5 PauseButton.Width := 25 PauseButton.Height := 23 PauseButton.Cursor := crHand PauseButton.ShowHint := True PauseButton.Hint := 'Приостановить музыку' PauseButton.OnClick := @PauseButtonOnClick PauseButton.Parent := WizardForm PauseImage := TBitmapImage.Create(WizardForm) PauseImage.Left := -36 PauseImage.Top := 0 PauseImage.Width := 288 PauseImage.Height := 23 PauseImage.Enabled := False PauseImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\MusicButton.bmp')) PauseImage.Parent := PauseButton // PauseImage.ReplaceColor:=$E2E2E2 PauseImage.ReplaceWithColor:=clBtnFace PauseLabel := TLabel.Create(WizardForm) PauseLabel.Width := PauseButton.Width PauseLabel.Height := PauseButton.Height PauseLabel.Autosize := False PauseLabel.Transparent := True PauseLabel.OnClick := @PauseButtonOnClick PauseLabel.OnMouseDown := @PauseMouseDown PauseLabel.OnMouseUp := @PauseMouseUp PauseLabel.OnMouseMove := @PauseMouseMove PauseLabel.Parent := PauseButton //Вставляем изображение в окно инсталлятора, для каждой страницы нужно добвлять изображение заново //Скрывем стандартные надписи, значки и чекбоксы with WizardForm do begin PageNameLabel.Hide; PageDescriptionLabel.Hide; WelcomeLabel1.Hide; WelcomeLabel2.Hide; DiskSpaceLabel.Hide; SelectDirBitmapImage.Hide; SelectDirBrowseLabel.Hide; SelectDirLabel.Hide; FinishedHeadingLabel.Hide; FinishedLabel.Hide; MainPanel.Hide FilenameLabel.Hide; StatusLabel.Hide; SelectStartMenuFolderLabel.Hide; SelectStartMenuFolderBrowseLabel.Hide; ReadyLabel.Hide; LicenseLabel1.Hide; InfoBeforeClickLabel.Hide; InfoAfterClickLabel.Hide; ComponentsDiskSpaceLabel.Hide; SelectComponentsLabel.Hide; //InnerNotebook.Hide;// эти строки не нужны //OuterNotebook.Hide; end; //Скрывем стандартные надписи, значки и чекбоксы with WizardForm do begin DirBrowseButton.Left:= DirBrowseButton.Left + ScaleX(40); //Местоположение кнопки "Обзор" от левого края, на странице выбора пути установки DirBrowseButton.Top:= DirBrowseButton.Top + ScaleY(72); //Местоположение кнопки "Обзор" сверху, на странице выбора пути установки //DirBrowseButton.Parent:= WizardForm;// эти не нужны DirEdit.Left:= DirEdit.Left + ScaleX(40); //Местоположение панели, где отображается путь от левого края, на странице выбора пути установки DirEdit.Top:= DirEdit.Top + ScaleY(72); //Местоположение панели, где отображается путь сверху, на странице выбора пути установки DirEdit.Color:=clBlack; //Цвет панели, где отображается путь, на странице выбора пути установки //DirEdit.Parent:= WizardForm;//эти не нужны GroupBrowseButton.Left:= GroupBrowseButton.Left + ScaleX(40); //Местоположение кнопки "Обзор" от левого края, на странице создания ярлыков в Главном Меню GroupBrowseButton.Top:= GroupBrowseButton.Top + ScaleY(72); //Местоположение кнопки "Обзор" сверху, на странице создания ярлыков в Главном Меню //GroupBrowseButton.Parent:= WizardForm;//эти не нужны GroupEdit.Left:= GroupEdit.Left + ScaleX(40); //Местоположение панели, где отображается путь от левого края, на странице создания ярлыков в Главном Меню GroupEdit.Top:= GroupEdit.Top + ScaleX(72); //Местоположение панели, где отображается путь сверху, на странице создания ярлыков в Главном Меню GroupEdit.Color:= ClBlack //Цвет панели, где отображается путь, на странице создания ярлыков в Главном Меню //GroupEdit.Parent:= WizardForm;//эти не нужны NextButton.BringToFront; //Выносим на передний план кнопки BackButton.BringToFront; //Выносим на передний план кнопки CancelButton.BringToFront; //Выносим на передний план кнопки Font.Style:=[]; //Стиль шрифта, используемого в инсталляторе Font.Name:= 'MS Sans Serif'; //Имя шрифта, используемого в инсталляторе Font.Color:=clWhite; //Цвет шрифта, используемого в инсталляторе ProgressGauge.Top:=ScaleY(120); //Местоположение Прогресс-бара сверху ProgressGauge.Left:=ScaleX(20); //Местоположение Прогресс-бара от левого края ProgressGauge.Width:=ScaleX(457); //Ширина Прогресс-бара ProgressGauge.Parent:= WizardForm;//эти не нужны ReadyMemo.Left:=ScaleX(40); //Местоположение сверху панели где отображаются данные выбранных компонентов, на странице готовности установки ReadyMemo.Top:= WizardForm.ReadyMemo.Top + ScaleY(72) //Цвет шрифта в панели где отображаются данные выбранных компонентов, на странице готовности установки ReadyMemo.Font.Color:= clBlack; //Стиль панели где отображаются данные выбранных компонентов, на странице готовности установки. Без скроллов - ssNone, с вертикальным скроллом - ssVertial, с горизонтальным скроллом - ssHorizontal, и со всеми скроллами - просто уберите эту строчку или ssBoth ReadyMemo.ScrollBars:= ssVertical; //ssNone ReadyMemo.Parent:= WizardForm;//эти не нужны end; //Эти строки вы не добавили //Это нужно для того чтоб картинка нормально отображалась with WizardForm do begin InnerNotebook.Left := ScaleX(0); InnerNotebook.Top := ScaleY(0); InnerNotebook.Width := ScaleX(497); //Ширина инсталлятора InnerNotebook.Height := ScaleY(360); //Высота инсталлятора OuterNotebook.Left := ScaleX(0); OuterNotebook.Top := ScaleY(0); OuterNotebook.Width := ScaleX(497); //Ширина инсталлятора OuterNotebook.Height := ScaleY(360); //Высота инсталлятора end; //Это нужно для того чтоб картинка нормально отображалась //Эти строки вы не добавили //Остальное PageNameLabel:= TLabel.Create(WizardForm); with PageNameLabel do begin Left:= WizardForm.PageNameLabel.Left; Top:= WizardForm.PageNameLabel.Top; Width:= ScaleX(300); Height:= ScaleY(14); AutoSize:= False; Font.Style:= [fsBold]; Font.Color:= clWhite; Transparent := True; Parent:= WizardForm; end; PageDescriptionLabel:= TLabel.Create(WizardForm); with PageDescriptionLabel do begin Left:= WizardForm.PageDescriptionLabel.Left; Top:= WizardForm.PageDescriptionLabel.top; Width:= ScaleX(400); Height:= WizardForm.PageDescriptionLabel.Height; AutoSize:= False; Wordwrap:= True; Transparent := True; Parent:= WizardForm; end; UpBevel:= TBevel.Create(WizardForm); with UpBevel do begin Shape:= bsTopLine; Style:= bsLowered; Left:= ScaleX(0); Top:= ScaleY(55); Width:= ScaleX(497); Parent:= WizardForm; end; DownBevel:= TBevel.Create(WizardForm); with DownBevel do begin Shape:= bsBottomLine; Style:= bsLowered; Left:= ScaleX(122); Top:= ScaleY(265); Width:= ScaleX(497); Parent:= WizardForm; end; BeveledLabel:= TLabel.Create(WizardForm); with BeveledLabel do begin Left:= ScaleX(3); Top:= ScaleY(307); Width:= ScaleX(40); Height:= ScaleY(12); Font.Color:= $3F3D37; Transparent:= true; Caption:=' RePacked by AngelDead ' Parent:= WizardForm; end; //WelcomePage, создаем надписи на странице WelcomeLabel1:= TLabel.Create(WizardForm); with WelcomeLabel1 do begin Left:= ScaleX(176); Top:= ScaleY(66); Width:= ScaleX(301); Height:= ScaleY(71); AutoSize:= false; Transparent:= true; WordWrap:= true; Font.Size:= 14; Font.Color:=clWhite Font.Style := [fsBold] Parent:= WizardForm.WelcomePage; Caption:= WizardForm.WelcomeLabel1.Caption; end; WelcomeLabel2:=TLabel.Create(WizardForm); with WelcomeLabel2 do begin Top:= ScaleY(136); Left:= ScaleX(176); Width:= ScaleX(301); Height:= ScaleY(300); AutoSize:= false; WordWrap:= true; Transparent:= true; Parent:= WizardForm.WelcomePage; Caption:= WizardForm.WelcomeLabel2.Caption; Font.Color:=clWhite end; //WelcomePage //licensePage, создаем надписи, кнопки на страниые LicenseLabel1:=TLabel.Create(WizardForm) with LicenseLabel1 do begin Left:=40 Top:=70 Width:=465 Height:=28 AutoSize:=False WordWrap:=True Transparent:=True Caption:=WizardForm.LicenseLabel1.Caption Parent:=WizardForm.LicensePage end; WizardForm.LicenseMemo.Left:=40 WizardForm.LicenseMemo.Top:=108 WizardForm.LicenseMemo.Parent:=WizardForm WizardForm.LicenseAcceptedRadio.Left:=40 WizardForm.LicenseAcceptedRadio.Top:=265 WizardForm.LicenseAcceptedRadio.Width:=14 WizardForm.LicenseAcceptedRadio.Height:=14 WizardForm.LicenseAcceptedRadio.Color:=clBlack WizardForm.LicenseAcceptedRadio.Parent:=WizardForm.LicensePage//добавил LicensePage LicenseAcceptedLabel:=TLabel.Create(WizardForm) with LicenseAcceptedLabel do begin Left:=56 Top:=265 Transparent:=True Caption:=WizardForm.LicenseAcceptedRadio.Caption Parent:=WizardForm.LicensePage OnClick:= @YesRadioOnClick end; WizardForm.LicenseNotAcceptedRadio.Left:=40 WizardForm.LicenseNotAcceptedRadio.Top:=285 WizardForm.LicenseNotAcceptedRadio.Width:=14 WizardForm.LicenseNotAcceptedRadio.Height:=14 WizardForm.LicenseNotAcceptedRadio.Color:=clBlack WizardForm.LicenseNotAcceptedRadio.Parent:=WizardForm.LicensePage//добавил LicensePage LicenseNotAcceptedLabel:=TLabel.Create(WizardForm) with LicenseNotAcceptedLabel do begin Left:=56 Top:=285 Transparent:=True Caption:=WizardForm.LicenseNotAcceptedRadio.Caption Parent:=WizardForm.LicensePage OnClick:= @NoRadioOnClick; end; PageNameLabel:= TLabel.Create(WizardForm); with PageNameLabel do begin Left:= WizardForm.PageNameLabel.Left; Top:= WizardForm.PageNameLabel.Top; Width:= ScaleX(300); Height:= ScaleY(14); AutoSize:= False; Font.Style:= [fsBold]; Font.Color:=clWhite Transparent := True; Parent:= WizardForm.LicensePage; end; PageDescriptionLabel:= TLabel.Create(WizardForm); with PageDescriptionLabel do begin Left:= WizardForm.PageDescriptionLabel.Left; Top:= WizardForm.PageDescriptionLabel.top; Width:= ScaleX(400); Height:= WizardForm.PageDescriptionLabel.Height; AutoSize:= False; Wordwrap:= True; Transparent := True; Parent:= WizardForm.LicensePage; end; //LicensePage //InfoBeforePage InfoBeforeClickLabel:= TLabel.Create(WizardForm); with InfoBeforeClickLabel do begin Left:= ScaleX(40); Top:= ScaleY(70) Width:= WizardForm.InfoBeforeClickLabel.Width; Height:= WizardForm.InfoBeforeClickLabel.Height; Transparent:= true; AutoSize:= False; WordWrap:= true; Parent:= WizardForm.InfoBeforePage; Caption:= WizardForm.InfoBeforeClickLabel.Caption; end; WizardForm.InfoBeforeMemo.left:= ScaleX(40); WizardForm.InfoBeforeMemo.Top:= ScaleY(108); WizardForm.InfoBeforeMemo.Parent:= WizardForm; PageNameLabel1:= TLabel.Create(WizardForm); with PageNameLabel1 do begin Left:= WizardForm.PageNameLabel.Left; Top:= WizardForm.PageNameLabel.Top; Width:= ScaleX(300); Height:= ScaleY(14); AutoSize:= False; Font.Style:= [fsBold]; Font.Color:=clWhite Transparent := True; Parent:= WizardForm.InfoBeforePage; end; PageDescriptionLabel1:= TLabel.Create(WizardForm); with PageDescriptionLabel1 do begin Left:= WizardForm.PageDescriptionLabel.Left; Top:= WizardForm.PageDescriptionLabel.top; Width:= ScaleX(400); Height:= WizardForm.PageDescriptionLabel.Height; AutoSize:= False; Wordwrap:= True; Transparent := True; Parent:= WizardForm.InfoBeforePage; end; //InfoBeforePage //SelectDirPage SelectDirLabel:= TLabel.Create(WizardForm); with SelectDirLabel do begin Caption:= WizardForm.SelectDirLabel.Caption; Left:= ScaleX(40); Top:= WizardForm.SelectDirLabel.Top + ScaleY(62); Width:= WizardForm.SelectDirLabel.Width; Height:= WizardForm.SelectDirLabel.Height; Transparent := True; Parent:= WizardForm.SelectDirPage; end; SelectDirLabelBrowse:= TLabel.Create(WizardForm); with SelectDirLabelBrowse do begin Caption:= WizardForm.SelectDirBrowseLabel.Caption; Left:= ScaleX(40); Top:= WizardForm.SelectDirBrowseLabel.Top + ScaleY(62); Width:= WizardForm.SelectDirBrowseLabel.Width; Height:= WizardForm.SelectDirBrowseLabel.Height; WordWrap:= True; Transparent:= True; Parent:= WizardForm.SelectDirPage; end; PageNameLabel2:= TLabel.Create(WizardForm); with PageNameLabel2 do begin Left:= WizardForm.PageNameLabel.Left; Top:= WizardForm.PageNameLabel.Top; Width:= ScaleX(300); Height:= ScaleY(14); AutoSize:= False; Font.Style:= [fsBold]; Font.Color:=clWhite Transparent := True; Parent:= WizardForm.SelectDirPage; end; PageDescriptionLabel2:= TLabel.Create(WizardForm); with PageDescriptionLabel2 do begin Left:= WizardForm.PageDescriptionLabel.Left; Top:= WizardForm.PageDescriptionLabel.top; Width:= ScaleX(400); Height:= WizardForm.PageDescriptionLabel.Height; AutoSize:= False; Wordwrap:= True; Transparent := True; Parent:= WizardForm.SelectDirPage; end; NeedSpaceLabel:= TLabel.Create(WizardForm); with NeedSpaceLabel do begin Parent:= WizardForm.SelectDirPage;//добавил SelectDirPage Left:= WizardForm.DirEdit.Left; Top:= ScaleY(262); Width:= ScaleX(209); Height:= ScaleY(13); Transparent:= True; Font.Color:=clWhite end; FreeSpaceLabel:= TLabel.Create(WizardForm); with FreeSpaceLabel do begin Parent:= WizardForm.SelectDirPage;//добавил SelectDirPage Left:= WizardForm.DirEdit.Left; Top:= ScaleY(280); Width:= ScaleX(209); Height:= ScaleY(13); Transparent:= True; Font.Color:=clWhite end; WizardForm.DirEdit.OnChange:= @GetFreeSpaceCaption; WizardForm.DirEdit.Text:= WizardForm.DirEdit.Text + #0; //SelectDirPage //SelectComponentPage SelectComponentsLabel:= TLabel.Create(WizardForm) with SelectComponentsLabel do begin Left:= ScaleX(40); Top:= SelectDirLabel.Top; Width:= WizardForm.SelectComponentsLabel.Width; Height:= WizardForm.SelectComponentsLabel.Height; Autosize:= false; WordWrap:= true; Transparent:= true; Caption:= WizardForm.SelectComponentsLabel.Caption; Parent:= WizardForm.SelectComponentsPage; end; WizardForm.TypesCombo.Left:= ScaleX(40); WizardForm.TypesCombo.Top:= ScaleY(120) WizardForm.TypesCombo.Font.Color:= clBlack; WizardForm.ComponentsList.Left:= ScaleX(40) WizardForm.ComponentsList.Top:= ScaleY(155); WizardForm.ComponentsList.Font.Color:= clBlack; ComponentsDiskSpaceLabel:= TLabel.Create(WizardForm); with ComponentsDiskSpaceLabel do begin Left:= ScaleX(40); Top:= ScaleY(295); Width:= WizardForm.ComponentsDiskSpaceLabel.Width; Height:= WizardForm.ComponentsDiskSpaceLabel.Height; Autosize:= false; WordWrap:= true; Transparent:= true; Caption:= WizardForm.ComponentsDiskSpaceLabel.Caption; Parent:= WizardForm.SelectComponentsPage; end; PageNameLabel3:= TLabel.Create(WizardForm); with PageNameLabel3 do begin Left:= WizardForm.PageNameLabel.Left; Top:= WizardForm.PageNameLabel.Top; Width:= ScaleX(300); Height:= ScaleY(14); AutoSize:= False; Font.Style:= [fsBold]; Font.Color:=clWhite Transparent := True; Parent:= WizardForm.SelectComponentsPage; end; PageDescriptionLabel3:= TLabel.Create(WizardForm); with PageDescriptionLabel3 do begin Left:= WizardForm.PageDescriptionLabel.Left; Top:= WizardForm.PageDescriptionLabel.top; Width:= ScaleX(400); Height:= WizardForm.PageDescriptionLabel.Height; AutoSize:= False; Wordwrap:= True; Transparent := True; Parent:= WizardForm.SelectComponentsPage; //SelectComponentPage //ProgrammGroupPage SelectStartMenuFolderLabel:=TLabel.Create(WizardForm) with SelectStartMenuFolderLabel do begin Left:= ScaleX(40); Top:= WizardForm.SelectDirLabel.Top + ScaleY(62); Width:= WizardForm.SelectDirBrowseLabel.Width; Height:= WizardForm.SelectDirBrowseLabel.Height; AutoSize:=False WordWrap:=True Transparent:=True Caption:=WizardForm.SelectStartMenuFolderLabel.Caption Parent:=WizardForm.SelectProgramGroupPage end; SelectStartMenuFolderBrowseLabel:=TLabel.Create(WizardForm) with SelectStartMenuFolderBrowseLabel do begin Left:= ScaleX(40); Top:= WizardForm.SelectDirBrowseLabel.Top + ScaleY(62); Width:= WizardForm.SelectDirBrowseLabel.Width Height:= WizardForm.SelectDirBrowseLabel.Height AutoSize:=False WordWrap:=True Transparent:=True Caption:=WizardForm.SelectStartMenuFolderBrowseLabel.Caption Parent:=WizardForm.SelectProgramGroupPage end; WizardForm.NoIconsCheck.Left:=ScaleX(40); WizardForm.NoIconsCheck.Top:= WizardForm.DirEdit.Top + ScaleY(140) WizardForm.NoIconsCheck.Width:=13 WizardForm.NoIconsCheck.Height:=13 WizardForm.NoIconsCheck.Visible:=True WizardForm.NoIconsCheck.Parent:= WizardForm.SelectProgramGroupPage//добавил NoIconsLabel:=TLabel.Create(WizardForm) with NoIconsLabel do begin Left:=ScaleX(56); Top:= WizardForm.DirEdit.Top + ScaleY(140) Transparent:=True OnClick:= @NoIconsLabelOnClick Caption:=WizardForm.NoIconsCheck.Caption Parent:=WizardForm end; PageNameLabel4:= TLabel.Create(WizardForm); with PageNameLabel4 do begin Left:= WizardForm.PageNameLabel.Left; Top:= WizardForm.PageNameLabel.Top; Width:= ScaleX(300); Height:= ScaleY(14); AutoSize:= False; Font.Style:= [fsBold]; Font.Color:=clWhite Transparent := True; Parent:= WizardForm.SelectProgramGroupPage; end; PageDescriptionLabel4:= TLabel.Create(WizardForm); with PageDescriptionLabel4 do begin Left:= WizardForm.PageDescriptionLabel.Left; Top:= WizardForm.PageDescriptionLabel.top; Width:= ScaleX(400); Height:= WizardForm.PageDescriptionLabel.Height; AutoSize:= False; Wordwrap:= True; Transparent := True; Parent:= WizardForm.SelectProgramGroupPage; end; //ProgrammGroupPage //SelectTasksPage SelectTasksLabel:= TLabel.Create(TasksPage); with SelectTasksLabel do begin Top:= ScaleY(70); Left:= ScaleX(40); Width:= ScaleX(417); Height:= ScaleY(30); Autosize:= false; WordWrap:= true; Transparent:= True; Parent:= TasksPage.Surface; Caption:= 'Нажмите «Установить», чтобы продолжить, или «Назад», если Вы хотите просмотреть или изменить опции установки.' Font.Color:=clWhite end; TasksLabel1:= TLabel.Create(TasksPage); with TasksLabel1 do begin Left:= ScaleX(40); Top:= SelectTasksLabel.Top + ScaleY(45); Width:= ScaleX(400); Height:= ScaleY(25); Autosize:= false; WordWrap:= true; Transparent:= true; Parent:= TasksPage.Surface; Caption:= ExpandConstant('{cm:TasksLabel1}'); Font.Color:=clWhite end; Icons:= TCheckBox.Create(TasksPage); with Icons do begin Parent:= TasksPage.Surface;//заменил WizardForm на TasksPage.Surface Left:= TasksLabel1.Left + 10; Top:= TasksLabel1.Top + 25; Width:= ScaleX(14); Height:= ScaleY(13); TabOrder:= 2; Checked:= False; Font.Color:=clWhite end; IconsLabel:= TLabel.Create(TasksPage); with IconsLabel do begin Caption:=ExpandConstant('{cm:Icons}'); Left:= TasksLabel1.Left + 30; Top:= TasksLabel1.Top + 25; Width:= ScaleX(150); Height:= ScaleY(13); Transparent := True; Parent:= TasksPage.Surface;//заменил WizardForm на TasksPage.Surface OnClick:= @IconsOnClick; Font.Color:=clWhite end; Group:= TCheckBox.Create(TasksPage); with Group do begin Parent:= TasksPage.Surface;//заменил WizardForm на TasksPage.Surface Left:= TasksLabel1.Left + 10; Top:= TasksLabel1.Top + 50; Width:= ScaleX(14); Height:= ScaleY(13); TabOrder:= 3; Checked:= False; Font.Color:=clWhite end; GroupLabel:= TLabel.Create(TasksPage); with GroupLabel do begin Caption:=ExpandConstant('{cm:Group}'); Left:= TasksLabel1.Left + 30; Top:= TasksLabel1.Top + 50; Width:= ScaleX(150); Height:= ScaleY(13); Transparent := True; Parent:= TasksPage.Surface;//заменил WizardForm на TasksPage.Surface OnClick:= @GroupOnClick; Font.Color:=clWhite end; TasksLabel2:= TLabel.Create(TasksPage); with TasksLabel2 do begin Left:= ScaleX(40); Top:= TasksLabel1.Top + ScaleY(75); Width:= ScaleX(400); Height:= ScaleY(25); Autosize:= false; WordWrap:= true; Transparent:= True; Parent:= TasksPage.Surface;//заменил WizardForm на TasksPage.Surface Caption:= ExpandConstant('{cm:TasksLabel2}') Font.Color:=clWhite end; DirectX:= TCheckBox.Create(TasksPage); with DirectX do begin Parent:= TasksPage.Surface;//заменил WizardForm на TasksPage.Surface Left:= TasksLabel2.Left + 10; Top:= TasksLabel2.Top + 25; Width:= ScaleX(14); Height:= ScaleY(13); TabOrder:= 0; Checked:= False; Font.Color:=clWhite end; DirectXLabel:= TLabel.Create(TasksPage); with DirectXLabel do begin Caption:= ExpandConstant('{cm:DirectX}'); Left:= TasksLabel2.Left + 30; Top:= TasksLabel2.Top + 25; Width:= ScaleX(150); Height:= ScaleY(13); Transparent := True; Parent:= TasksPage.Surface;//заменил WizardForm на TasksPage.Surface OnClick:= @DirectXLabelOnClick; Font.Color:=clWhite end; Redist:= TCheckBox.Create(TasksPage); with Redist do begin Parent:= TasksPage.Surface;//заменил WizardForm на TasksPage.Surface Left:= TasksLabel2.Left + 10; Top:= TasksLabel2.Top + 50; Width:= ScaleX(14); Height:= ScaleY(13); TabOrder:= 1; Checked:= False; Font.Color:=clWhite end; RedistLabel:= TLabel.Create(TasksPage); with RedistLabel do begin Caption:=ExpandConstant('{cm:Redist}'); Left:= TasksLabel2.Left + 30; Top:= TasksLabel2.Top + 50; Width:= ScaleX(150); Height:= ScaleY(13); Transparent := True; Parent:= TasksPage.Surface;//заменил WizardForm на TasksPage.Surface OnClick:= @RedistOnClick; Font.Color:=clWhite end; PageNameLabel5:= TLabel.Create(TasksPage); with PageNameLabel5 do begin Left:= WizardForm.PageNameLabel.Left; Top:= WizardForm.PageNameLabel.Top; Width:= ScaleX(300); Height:= ScaleY(14); AutoSize:= False; Font.Style:= [fsBold]; Font.Color:=clWhite Transparent := True; Parent:= TasksPage.Surface;//заменил WizardForm на TasksPage.Surface end; PageDescriptionLabel5:= TLabel.Create(TasksPage); with PageDescriptionLabel5 do begin Left:= WizardForm.PageDescriptionLabel.Left; Top:= WizardForm.PageDescriptionLabel.top; Width:= ScaleX(400); Height:= WizardForm.PageDescriptionLabel.Height; AutoSize:= False; Wordwrap:= True; Transparent := True; Parent:= TasksPage.Surface;//заменил WizardForm на TasksPage.Surface Font.Color:=clWhite end; //SelectTasksPage //ReadyPage ReadyLabel:= TLabel.Create(WizardForm); with ReadyLabel do begin Left:= ScaleX(40); Top:= ScaleY(70); Width:= ScaleX(325); Height:= ScaleY(30); AutoSize:= False; WordWrap:= true; Transparent:= true; Caption:= 'Нажмите «Установить», чтобы продолжить, или «Назад», если Вы хотите просмотреть или изменить опции установки.' Parent:=WizardForm.ReadyPage; end; PageNameLabel6:= TLabel.Create(WizardForm); with PageNameLabel6 do begin Left:= WizardForm.PageNameLabel.Left; Top:= WizardForm.PageNameLabel.Top; Width:= ScaleX(300); Height:= ScaleY(14); AutoSize:= False; Font.Style:= [fsBold]; Font.Color:=clWhite Transparent := True; Parent:= WizardForm.ReadyPage; end; PageDescriptionLabel6:= TLabel.Create(WizardForm); with PageDescriptionLabel6 do begin Left:= WizardForm.PageDescriptionLabel.Left; Top:= WizardForm.PageDescriptionLabel.top; Width:= ScaleX(400); Height:= WizardForm.PageDescriptionLabel.Height; AutoSize:= False; Wordwrap:= True; Transparent := True; Parent:= WizardForm.ReadyPage; end; WizardForm.ReadyMemo.Font.Color:= clWhite; //ReadyPage //InstallingPage StatusLabel:= TLabel.Create(WizardForm); with StatusLabel do begin Left:= ScaleX(20); Top:= ScaleY(80); Width:= WizardForm.StatusLabel.Width; Height:= WizardForm.StatusLabel.Height; AutoSize:= False; Transparent := True; Parent:= WizardForm.InstallingPage; Caption:= 'Распаковка файлов...' Font.Color:=clBlack end; FilenameLabel:= TLabel.Create(WizardForm); with FilenameLabel do begin Left:= ScaleX(20); Top:= ScaleY(100); Width:= WizardForm.StatusLabel.Width; Height:= WizardForm.StatusLabel.Height; AutoSize:= False; Transparent := True; Parent:= WizardForm.InstallingPage; Font.Color:=clWhite end; PageNameLabel7:= TLabel.Create(WizardForm); with PageNameLabel7 do begin Left:= WizardForm.PageNameLabel.Left; Top:= WizardForm.PageNameLabel.Top; Width:= ScaleX(300); Height:= ScaleY(14); AutoSize:= False; Font.Style:= [fsBold]; Font.Color:=clWhite Transparent := True; Parent:= WizardForm.InstallingPage; end; PageDescriptionLabel7:= TLabel.Create(WizardForm); with PageDescriptionLabel7 do begin Left:= WizardForm.PageDescriptionLabel.Left; Top:= WizardForm.PageDescriptionLabel.top; Width:= ScaleX(400); Height:= WizardForm.PageDescriptionLabel.Height; AutoSize:= False; Wordwrap:= True; Transparent := True; Parent:= WizardForm.InstallingPage; Font.Color:=clWhite end; //InstallingPage //InfoAfterPage InfoAfterClickLabel:= TLabel.Create(WizardForm); with InfoAfterClickLabel do begin Left:= ScaleX(40); Top:= ScaleY(70) Width:= WizardForm.InfoAfterClickLabel.Width; Height:= WizardForm.InfoAfterClickLabel.Height; Transparent:= true; AutoSize:= False; WordWrap:= true; Parent:= WizardForm.InfoAfterPage; Caption:= WizardForm.InfoAfterClickLabel.Caption; end; WizardForm.InfoAfterMemo.left:= ScaleX(40); WizardForm.InfoAfterMemo.Top:= ScaleY(108); WizardForm.InfoAfterMemo.Parent:= WizardForm.InfoAfterPage; PageNameLabel8:= TLabel.Create(WizardForm); with PageNameLabel8 do begin Left:= WizardForm.PageNameLabel.Left; Top:= WizardForm.PageNameLabel.Top; Width:= ScaleX(300); Height:= ScaleY(14); AutoSize:= False; Font.Style:= [fsBold]; Font.Color:=clWhite Transparent := True; Parent:= WizardForm.InfoAfterPage; end; PageDescriptionLabel8:= TLabel.Create(WizardForm); with PageDescriptionLabel8 do begin Left:= WizardForm.PageDescriptionLabel.Left; Top:= WizardForm.PageDescriptionLabel.top; Width:= ScaleX(400); Height:= WizardForm.PageDescriptionLabel.Height; AutoSize:= False; Wordwrap:= True; Transparent := True; Parent:= WizardForm.InfoAfterPage; end; //InfoAfterPage //FinishedPage FinishedHeadingLabel:=TLabel.Create(WizardForm); with FinishedHeadingLabel do begin Top:= ScaleY(66); Left:= ScaleX(176); Width:= ScaleX(301); Height:= ScaleY(53); AutoSize:= false; WordWrap:= true; Font.Size:= 14; Font.Color:=clWhite Font.Style := [fsBold] Transparent:= true; Parent:= WizardForm.FinishedPage; Caption:= WizardForm.FinishedHeadingLabel.Caption; end; FinishedLabel:= TLabel.Create(WizardForm); with FinishedLabel do begin Left:= ScaleX(176); Top:= ScaleY(136); Width:= ScaleX(301); Height:= ScaleY(54); AutoSize:= false; WordWrap:= true; Transparent:= true; Parent:= WizardForm.FinishedPage; Caption:= ExpandConstant('{cm:Finished1}') + #10#13#10 + ExpandConstant('{cm:Finished2}') Font.Color:=clWhite end; RunProgram:= TCheckBox.Create(WizardForm); with RunProgram do begin Parent:= WizardForm; Left:= ScaleX(176); Top:= ScaleY(200); Width:= ScaleX(14); Height:= ScaleY(14); TabOrder:= 4; Checked:= True; end; RunProgramLabel:= TLabel.Create(WizardForm); with RunProgramLabel do begin Caption:=ExpandConstant('{cm:RunProgram}'); Left:= ScaleX(196); Top:= ScaleY(200); Width:= ScaleX(150); Height:= ScaleY(13); Transparent := True; Parent:= WizardForm.FinishedPage;//добавил FinishedPage OnClick:= @RunProgramOnClick; Font.Color:=clWhite end; //FinishedPage //Скрываем все end; end; procedure CurPageChanged1(CurPageID: Integer); begin PageNameLabel.Caption:= WizardForm.PageNameLabel.Caption; PageDescriptionLabel.Caption:= WizardForm.PageDescriptionLabel.Caption; PageNameLabel1.Caption:= WizardForm.PageNameLabel.Caption; PageDescriptionLabel1.Caption:= WizardForm.PageDescriptionLabel.Caption; PageNameLabel2.Caption:= WizardForm.PageNameLabel.Caption; PageDescriptionLabel2.Caption:= WizardForm.PageDescriptionLabel.Caption; PageNameLabel3.Caption:= WizardForm.PageNameLabel.Caption; PageDescriptionLabel3.Caption:= WizardForm.PageDescriptionLabel.Caption; PageNameLabel4.Caption:= WizardForm.PageNameLabel.Caption; PageDescriptionLabel4.Caption:= WizardForm.PageDescriptionLabel.Caption; PageNameLabel5.Caption:= 'Выберите дополнительные задачи'; PageDescriptionLabel5.Caption:= 'Какие дополнительные задачи необходимо выполнить?'; PageNameLabel6.Caption:= WizardForm.PageNameLabel.Caption; PageDescriptionLabel6.Caption:= WizardForm.PageDescriptionLabel.Caption; PageNameLabel7.Caption:= WizardForm.PageNameLabel.Caption; PageDescriptionLabel7.Caption:= WizardForm.PageDescriptionLabel.Caption; PageNameLabel8.Caption:= WizardForm.PageNameLabel.Caption; PageDescriptionLabel8.Caption:= WizardForm.PageDescriptionLabel.Caption; PageID:=CurPageID; PageNameLabel.Show; PageDescriptionLabel.Show; UpBevel.Show; UpBevel.BringToFront; WelcomeLabel1.Hide; WelcomeLabel2.Hide; LicenseAcceptedLabel.Hide; LicenseLabel1.Hide; LicenseNotAcceptedLabel.Hide; WizardForm.LicenseMemo.Hide; WizardForm.LicenseAcceptedRadio.Hide; WizardForm.LicenseNotAcceptedRadio.Hide; SelectDirLabel.Hide; SelectDirLabelBrowse.Hide; NeedSpaceLabel.Hide; FreeSpaceLabel.Hide; WizardForm.DirEdit.Hide; WizardForm.DirBrowseButton.Hide; InfoBeforeClickLabel.Hide; WizardForm.InfoBeforeMemo.Hide; SelectComponentsLabel.Hide; WizardForm.TypesCombo.Hide; WizardForm.ComponentsList.Hide; ComponentsDiskSpaceLabel.Hide; WizardForm.NoIconsCheck.Hide; WizardForm.GroupEdit.Hide; WizardForm.GroupBrowseButton.Hide; SelectStartMenuFolderLabel.Hide; SelectStartMenuFolderBrowseLabel.Hide; NoIconsLabel.Hide; SelectTasksLabel.Hide; TasksLabel1.Hide; TasksLabel2.Hide; Icons.Hide; IconsLabel.Hide; Group.Hide; GroupLabel.Hide; Redist.Hide; RedistLabel.Hide; DirectX.Hide; DirectXLabel.Hide; WizardForm.ReadyMemo.Hide; ReadyLabel.Hide; StatusLabel.Hide; FilenameLabel.Hide; WizardForm.ProgressGauge.Hide; WizardForm.InfoAfterMemo.Hide; InfoAfterClickLabel.Hide; FinishedLabel.Hide; FinishedHeadingLabel.Hide; RunProgram.Hide; RunProgramLabel.Hide; PageNameLabel.Caption:= WizardForm.PageNameLabel.Caption; PageDescriptionLabel.Caption:= WizardForm.PageDescriptionLabel.Caption; PageID:=CurPageID; if CurPageID = wpWelcome then begin PageNameLabel.Hide; PageDescriptionLabel.Hide; UpBevel.Hide; WelcomeLabel1.Show; WelcomeLabel2.Show; end; if CurPageID = wpLicense then begin LicenseAcceptedLabel.Show; LicenseLabel1.Show; LicenseNotAcceptedLabel.Show; WizardForm.LicenseMemo.Show; WizardForm.LicenseAcceptedRadio.Show; WizardForm.LicenseNotAcceptedRadio.Show; end; if CurPageID = wpInfoBefore then begin InfoBeforeClickLabel.Show; WizardForm.InfoBeforeMemo.Show; end; if CurPageID = wpSelectDir then begin SelectDirLabel.Show; SelectDirLabelBrowse.Show; NeedSpaceLabel.Show; FreeSpaceLabel.Show; WizardForm.DirEdit.Show; WizardForm.DirBrowseButton.Show; GetNeedSpaceCaption; if FreeMB < NeedSize then WizardForm.NextButton.Enabled:=False; end; if CurPageId = wpSelectComponents then begin SelectComponentsLabel.Show; WizardForm.TypesCombo.Show; WizardForm.ComponentsList.Show; ComponentsDiskSpaceLabel.Show; end; if CurPageID = wpSelectProgramGroup then begin WizardForm.NoIconsCheck.Show; WizardForm.GroupEdit.Show; WizardForm.GroupBrowseButton.Show; SelectStartMenuFolderLabel.Show; SelectStartMenuFolderBrowseLabel.Show; NoIconsLabel.Hide; end; if CurPageID = TasksPage.Id then begin SelectTasksLabel.Show; TasksLabel1.Show; TasksLabel2.Show; Icons.Show; IconsLabel.Show; Group.Show; GroupLabel.Show; Redist.Show; RedistLabel.Show; DirectX.Show; DirectXLabel.Show; WizardForm.NextButton.Caption:= 'Установить'; PageNameLabel.Caption:= 'Выберите дополнительные задачи'; PageDescriptionLabel.Caption:= 'Какие дополнительные задачи необходимо выполнить?'; end; if CurPageID = wpReady then begin WizardForm.ReadyMemo.Show; ReadyLabel.Show; end; if CurPageId = wpInstalling then begin StatusLabel.Show; FilenameLabel.Show; WizardForm.ProgressGauge.Show; end; if CurPageID = wpInfoAfter then begin WizardForm.InfoAfterMemo.Show; InfoAfterClickLabel.Show; end; if CurPageId = wpFinished then begin FinishedLabel.Show; FinishedHeadingLabel.Show; RunProgram.Show; RunProgramLabel.Show; PageNameLabel.Hide; PageDescriptionLabel.Hide; UpBevel.Hide; end; end; procedure CurStepChanged1(CurStep: TSetupStep); Var ResultCode: integer; begin if CurStep = ssPostInstall then begin FilenameLabel.Visible:=false; if DirectX.Checked then begin StatusLabel.Caption:=ExpandConstant('{cm:DirectXInstall}') Exec(ExpandConstant('{src}\Redist\DirectX\DXSETUP.exe'), '/silent', ExpandConstant('{src}\Redist\DirectX'), SW_SHOW, ewWaitUntilTerminated, ResultCode); end; if Redist.Checked then begin StatusLabel.Caption:=ExpandConstant('{cm:RedistInstall}') Exec(ExpandConstant('{src}\Redist\vcredist_x86'), '/Q', ExpandConstant('{src}\Redist'), SW_SHOW, ewWaitUntilTerminated, ResultCode); end; end; end; //******************************************* [Начало - FreArc] ***************************************************// type #ifdef UNICODE #define A "W" #else #define A "A" ;// точка входа в SetWindowText, {#A} меняется на A или W в зависимости от версии PAnsiChar = PChar; // Required for Inno Setup 5.3.0 and lower. (требуется для Inno Setup версии 5.3.0 и ниже) #endif #if Ver < 84018176 AnsiString = String; // There is no need for this line in Inno Setup 5.2.4 and above (для Inno Setup версий 5.2.4 и выше эта строка не нужна) #endif TMessage = record hWnd: HWND; msg, wParam: Word; lParam: LongWord; Time: TFileTime; pt: TPoint; end; TFreeArcCallback = function (what: PAnsiChar; int1, int2: Integer; str: PAnsiChar): Integer; TArc = record Path, Dest, comp, task: string; allMb, Files: Integer; Size: Extended; end; TBarInfo = record stage, name: string; size, allsize: Extended; count, perc, pos, mb, time: Integer; end; TCWPSTRUCT = record lParam: LongWord; wParam: Word; Msg: LongWord; hwnd: HWnd; end; TCWPSTRUCTProc = procedure(Code: Integer; wParam: Word; lParam: TCWPSTRUCT); TTimerProc = procedure(HandleW, Msg, idEvent, TimeSys: LongWord); var ExtractFile, StatusInfo: TLabel; ProgressBar: TNewProgressBar; CancelCode, n, ArcInd, UnPackError, StartInstall, LastTimerEvent, lastMb, baseMb: Integer; WndHookID, TimerID: LongWord; Arcs, Records: array of TArc; msgError: string; Status: TBarInfo; FreezeTimer: Boolean; totalUncompressedSize, origsize: Integer; // total uncompressed size of archive data in mb Texture2, Texture: TBitmapImage; const PM_REMOVE = 1; CP_ACP = 0; CP_UTF8 = 65001; oneMB=1024*1024; Period = 250; // частота обновления кнопки таскбара и строки статуса BackColor = $fcfbfb; EndColor = $d8e9ec; // цвета подобраны для темы Луна VK_ESCAPE = 27; HC_ACTION = 0; WH_CALLWNDPROC = 4; WM_PAINT = $F; CancelDuringInstall = {#isFalse(SetupSetting("AllowCancelDuringInstall"))}; function WrapFreeArcCallback (callback: TFreeArcCallback; paramcount: integer):longword; external 'wrapcallback@files:innocallback.dll stdcall'; function FreeArcExtract (callback: longword; cmd1,cmd2,cmd3,cmd4,cmd5,cmd6,cmd7,cmd8,cmd9,cmd10: PAnsiChar): integer; external 'FreeArcExtract@files:unarc.dll cdecl'; Function OemToChar(lpszSrc, lpszDst: AnsiString): longint; external 'OemToCharA@user32.dll stdcall'; Function MultiByteToWideChar(CodePage: UINT; dwFlags: DWORD; lpMultiByteStr: PAnsiChar; cbMultiByte: integer; lpWideCharStr: PAnsiChar; cchWideChar: integer): longint; external 'MultiByteToWideChar@kernel32.dll stdcall'; Function WideCharToMultiByte(CodePage: UINT; dwFlags: DWORD; lpWideCharStr: PAnsiChar; cchWideChar: integer; lpMultiByteStr: PAnsiChar; cbMultiByte: integer; lpDefaultChar: integer; lpUsedDefaultChar: integer): longint; external 'WideCharToMultiByte@kernel32.dll stdcall'; function PeekMessage(var lpMsg: TMessage; hWnd: HWND; wMsgFilterMin, wMsgFilterMax, wRemoveMsg: UINT): BOOL; external 'PeekMessageA@user32.dll stdcall'; function TranslateMessage(const lpMsg: TMessage): BOOL; external 'TranslateMessage@user32.dll stdcall'; function DispatchMessage(const lpMsg: TMessage): Longint; external 'DispatchMessageA@user32.dll stdcall'; function GetTickCount: DWord; external 'GetTickCount@kernel32'; function GetWindowLong(hWnd, nIndex: Integer): Longint; external 'GetWindowLongA@user32 stdcall delayload'; function SetWindowText(hWnd: Longint; lpString: String): Longint; external 'SetWindowText{#A}@user32 stdcall delayload'; function GetKeyState(nVirtKey: Integer): ShortInt; external 'GetKeyState@user32 stdcall delayload'; function GetCurrentThreadID: LongWord; external 'GetCurrentThreadId@kernel32 stdcall delayload'; function MulDiv(Number, Numerator, Denominator: Integer): Integer; external 'MulDiv@kernel32 stdcall delayload'; function CallNextWNDPROC(idHook: LongWord; Code: Integer; wParam: Word; lParam: TCWPSTRUCT): LongWord; external 'CallNextHookEx@user32 stdcall delayload'; function SetWindowsHookEx(idHook: LongWord; callback: LongWord; hMod: LongWord; dwThreadID: HWND): LongWord; external 'SetWindowsHookExW@user32 stdcall delayload'; function UnhookWindowsHookEx(idHook: LongWord): LongWord; external 'UnhookWindowsHookEx@user32 stdcall delayload'; function WrapCWPSTRUCTProc(callback:TCWPSTRUCTProc; paramcount:integer): longword; external 'wrapcallback@files:innocallback.dll'; function WrapTimerProc(callback: TTimerProc; Paramcount: Integer): longword; external 'wrapcallback@files:innocallback.dll stdcall'; function SetTimer(hWnd, nIDEvent, uElapse, lpTimerFunc: LongWord): longword; external 'SetTimer@user32'; function KillTimer(hWnd, nIDEvent: LongWord): LongWord; external 'KillTimer@user32 stdcall delayload'; procedure AppProcessMessage; var Msg: TMessage; begin if not PeekMessage(Msg, {WizardForm.Handle} 0, 0, 0, PM_REMOVE) then Exit; TranslateMessage(Msg); DispatchMessage(Msg); end; Function FreeArcCmd(callback: longword; cmd1,cmd2,cmd3,cmd4,cmd5,cmd6,cmd7,cmd8,cmd9,cmd10: PAnsiChar): integer; Begin CancelCode:= 0; AppProcessMessage; try Result:= FreeArcExtract(callback, cmd1,cmd2,cmd3,cmd4,cmd5,cmd6,cmd7,cmd8,cmd9,cmd10); // Pass the specified arguments to 'unarc.dll' if CancelCode < 0 then Result:= CancelCode; except Result:= -63; // ArcFail end; End; // Sets the TaskBar title Procedure SetTaskBarTitle(Title: String); var h: Integer; Begin h:= GetWindowLong(MainForm.Handle, -8); if h <> 0 then SetWindowText(h, Title); End; Function ByteOrTB(Bytes: Extended; noMB: Boolean): String; {Перевод числа в значение бт/Кб/Мб/Гб/Тб (до 2х знаков после запятой)} Begin if not noMB then Result:= NumToStr(Int(Bytes)) +' Mb' else if Bytes < 1024 then if Bytes = 0 then Result:= '0' else Result:= NumToStr(Int(Bytes)) +' Bt' else if Bytes/1024 < 1024 then Result:= NumToStr(round((Bytes/1024)*10)/10) +' Kb' else If Bytes/oneMB < 1024 then Result:= NumToStr(round(Bytes/oneMB*100)/100) +' Mb' else If Bytes/oneMB/1000 < 1024 then Result:= NumToStr(round(Bytes/oneMB/1024*1000)/1000) +' Gb' else Result:= NumToStr(round(Bytes/oneMB/oneMB*1000)/1000) +' Tb'; 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; Function CreateLabel(Parent: TWinControl; AutoSize, WordWrap, Transparent: Boolean; FontName: String; FontStyle: TFontStyles; FontColor: TColor; Left, Top, Width, Height: Integer; Prefs: TObject): TLabel; Begin Result:=TLabel.Create(Parent); Result.parent:= Parent; if Prefs <> Nil then begin Top:= TWinControl(Prefs).Top; Left:= TWinControl(Prefs).Left; Width:= TWinControl(Prefs).Width; Height:= TWinControl(Prefs).Height; end; if Top > 0 then result.Top:=Top; if Left > 0 then result.Left:= Left; if Width > 0 then result.Width:= Width; if Height > 0 then result.Height:= Height; if FontName <> '' then result.Font.Name:= FontName; if FontColor > 0 then result.Font.Color:= FontColor; if FontStyle <> [] then result.Font.Style:= FontStyle; result.AutoSize:= AutoSize; result.WordWrap:= WordWrap; result.Transparent:=Transparent; result.ShowHint:= true; End; // Converts milliseconds to human-readable time // Конвертирует милисекунды в человеко-читаемое изображение времени Function TicksToTime(Ticks: DWord; h,m,s: String; detail: Boolean): String; Begin if detail then {hh:mm:ss format} Result:= PADZ(IntToStr(Ticks/3600000), 2) +':'+ PADZ(IntToStr((Ticks/1000 - Ticks/1000/3600*3600)/60), 2) +':'+ PADZ(IntToStr(Ticks/1000 - Ticks/1000/60*60), 2) else if Ticks/3600 >= 1000 then {more than hour} Result:= IntToStr(Ticks/3600000) +h+' '+ PADZ(IntToStr((Ticks/1000 - Ticks/1000/3600*3600)/60), 2) +m else if Ticks/60 >= 1000 then {1..60 minutes} Result:= IntToStr(Ticks/60000) +m+' '+ IntToStr(Ticks/1000 - Ticks/1000/60*60) +s else Result:= Format('%.1n', [Abs(Ticks/1000)]) +s {less than one minute} End; Function ExpandENV(string: String): String; var n: UINT; Begin // ExpandConstant + развёртывание DOS-переменных типа %SystemRoot% if Pos('{',string) * Pos('}',string) = 0 then Result:= String else Result:= ExpandConstant(String); n:= Pos('%',result); if n = 0 then Exit; Delete(result, n,1); Result:= Copy(Result,1, n-1) + ExpandConstant('{%'+Copy(Result, n, Pos('%',result) -n) +'}') + Copy(Result, Pos('%',result) +1, Length(result)) End; Function cm(Message: String): String; Begin Result:= ExpandConstant('{cm:'+ Message +'}') End; Function LoWord(lw: LongWord): LongWord; Begin Result:= lw shr 16; End; Function Size64(Hi, Lo: Integer): Extended; Begin Result:= Lo; if Lo<0 then Result:= Result + $7FFFFFFF + $7FFFFFFF + 2; for Hi:= Hi-1 Downto 0 do Result:= Result + $7FFFFFFF + $7FFFFFFF + 2; End; Function RGB(r, g, b: Longint): Longint; Begin Result:= (r or (g shl 8) or (b shl 16)) End; Function GetBValue(rgb: DWord): Byte; Begin Result:= Byte(rgb shr 16) End; Function GetGValue(rgb: DWord): Byte; Begin Result:= Byte(rgb shr 8) End; Function GetRValue(rgb: DWord): Byte; Begin Result:= Byte(rgb) End; Procedure GradientFill(WorkBmp: TBitmapImage; BeginColor, FinishColor: Integer); var ColorBand: TRect; StartColor, i: Integer; Begin {если BeginColor < 0, то градиент горизонтальный} WorkBmp.Bitmap.Width:= WorkBmp.Width; WorkBmp.Bitmap.Height:= WorkBmp.Height; StartColor:= trunc(Abs(BeginColor)) if BeginColor < 0 then n:= WorkBmp.Width else n:= WorkBmp.Height; for i:=0 to n do begin if BeginColor < 0 then begin ColorBand.Top:= 0; ColorBand.Bottom:= WorkBmp.Height; ColorBand.Left:= MulDiv(i, WorkBmp.Width, n); ColorBand.Right:= MulDiv(i+1, WorkBmp.Width, n); end else begin ColorBand.Top:= MulDiv(i, WorkBmp.Height, n); ColorBand.Bottom:= MulDiv(i+1, WorkBmp.Height, n); ColorBand.Left:= 0; ColorBand.Right:= WorkBmp.Width; end; WorkBmp.Bitmap.Canvas.Brush.Color:= RGB(GetRValue(StartColor) + MulDiv(I, GetRValue(FinishColor) - GetRValue(StartColor), n-1), GetGValue(StartColor) + MulDiv(I, GetGValue(FinishColor) - GetGValue(StartColor), n-1), GetBValue(StartColor) + MulDiv(I, GetBValue(FinishColor) - GetBValue(StartColor), n-1)); WorkBmp.Bitmap.Canvas.FillRect(ColorBand); end; End; // Converts OEM encoded string into ANSI (Преобразует OEM строку в ANSI кодировку) function OemToAnsiStr(strSource: AnsiString): AnsiString; var nRet : longint; begin SetLength(Result, Length(strSource)); nRet:= OemToChar(strSource, Result); end; // Converts ANSI encoded string into UTF-8 (Преобразует строку из ANSI в UTF-8 кодировку) function AnsiToUtf8(strSource: string): string; var nRet, nRet2: integer; WideCharBuf, MultiByteBuf: AnsiString; begin SetLength(WideCharBuf, Length(strSource) * 2); SetLength(MultiByteBuf, Length(strSource) * 2); nRet:= MultiByteToWideChar(CP_ACP, 0, strSource, -1, WideCharBuf, Length(WideCharBuf)); nRet2:= WideCharToMultiByte(CP_UTF8, 0, WideCharBuf, -1, MultiByteBuf, Length(MultiByteBuf), 0, 0); if nRet * nRet2 = 0 then Result:= strSource else Result:= MultiByteBuf; end; // ArcInd - текущий архив, счёт с 0 // baseMb - записано из пред. архива на диск // lastMb - извлечено из тек. архива на диск // Status.mb - позиция в текущем архиве // Status.allsize - объём всех архивов // Status.size - всего извлечено Мб на текущий момент // totalUncompressedSize - точный объём данных в архивах // общий прогресс нарастает по мере записи данных из архива на диск (точка 'write') // прогресс архивов двигается в соответствии с позицией в текущем архиве (точка 'read') Procedure UpdateStatus(Flags: Integer); // выполняется с периодичностью, заданной константой Period var Remaining: Integer; i, t, s: string; Begin if Flags and $1 > 0 then FreezeTimer:= Flags and $2 = 0; // bit 0 = 1 change start/stop, bit 1 = 0 stop, bit 1 = 1 start if (Flags and $4 > 0) or (Status.size <> baseMb+lastMb) then LastTimerEvent:= 0; // bit 2 = 1 UpdateNow // обновить по флагу или записи из архива на диск if FreezeTimer or (GetTickCount - LastTimerEvent <= Period) then Exit else LastTimerEvent:= GetTickCount; Status.size := baseMb+lastMb; // извлечено на текущий момент if totalUncompressedSize > 0 then with WizardForm.ProgressGauge do begin // основной прогресс движется по мере записи данных на диск Position:= round(Max * Status.size/totalUncompressedSize) end; with WizardForm.ProgressGauge do begin // оставшееся время #ifndef precomp // к сожалению, этот код иногда сбоит на очень больших архивах, созданных с использованием внешних упаковщиков if position > 0 then Remaining:= trunc((GetTickCount - StartInstall) * Abs((max - position)/position)) else #endif Remaining:= 0; t:= cm('ending'); i:= t; if Remaining > 0 then begin t:= FmtMessage(cm('taskbar'), [IntToStr(Status.perc/10), TicksToTime(Remaining, 'h', 'm', 's', false)]) i:= TicksToTime(Remaining, cm('hour'), cm('min'), cm('sec'), false) end; end; SetTaskBarTitle(t); // проценты и оставшееся время на кнопке инсталлятора if Status.size > 0 then s:= ' ['+ ByteOrTB(Status.size*oneMB, true) +']'; // если сделать подсчёт размера папки {app} через CalcDirSize, то при частом пересчёте папки большого объёма это может замедлить работу StatusInfo.Caption:= FmtMessage(cm('StatusInfo'), [IntToStr(Status.count +ord(Status.count < 0)), s, Format('%.1n', [Abs(Status.perc/10)]), i]); // второй прогрессбар движется по мере считывания текущего архива if (Status.stage = cm('ArcTitle')) and (GetArrayLength(Arcs) > 0) then begin ExtractFile.Caption:= FmtMessage(cm('ArcInfo'), [IntToStr(ArcInd+1), IntToStr(GetArrayLength(Arcs)), ByteOrTB(Arcs[ArcInd].Size, true), Format('%.0n', [Status.mb/(Arcs[ArcInd].Size/oneMB)*100]), ByteOrTB(Status.allsize, true)]) ProgressBar.Position:= round(ProgressBar.Max * Status.mb/trunc(Arcs[ArcInd].Size/oneMB)) end; End; Procedure MyTimerProc(h, msg, idevent, dwTime: Longword); Begin if WizardForm.CurPageID = wpInstalling then UpdateStatus(0); End; Procedure OnWndHook(Code: Integer; wParam: Word; lParam: TCWPSTRUCT); Begin if (Code = HC_ACTION) and (LoWord(lParam.msg) = WM_PAINT) then begin // подготовка данных для последующего отображения по таймеру if (Status.name <> WizardForm.FileNameLabel.Caption) and (WizardForm.FileNameLabel.Caption <> '') then begin // имя файла, названия ярлыка и прочее Status.name:= WizardForm.FileNameLabel.Caption; // начало извлечения или распаковки очередного файла Case Status.stage of SetupMessage(msgStatusExtractFiles): // этап извлечения файлов инсталлятором Status.count:= Status.count +1; // кол-во файлов End; end; if (Status.stage <> WizardForm.StatusLabel.Caption) and (WizardForm.StatusLabel.Caption <> '') then begin StatusLabel.Caption:= WizardForm.StatusLabel.Caption; Status.stage:= WizardForm.StatusLabel.Caption; // текущий этап установки if Status.stage = SetupMessage(msgStatusRollback) then begin WizardForm.StatusLabel.Hide; WizardForm.FileNameLabel.Hide; StatusInfo.Hide; ExtractFile.Hide; ProgressBar.Hide; end; end; with WizardForm.ProgressGauge do begin n:= (Max - Min)/1000 if n > 0 then Status.perc:= (Position-Min)/n; // 1000 процентов end; UpdateStatus(0); end; CallNextWNDPROC(WndHookID, Code, wParam, lParam) {освобождение события} End; // compsize: в Mb объём архива // total_files: в int2 ? число файлов в архиве // origsize: в Mb общий объём данных в архиве // write: в Mb число записанных (распакованных из архива) на диск мегабайт // read: в Mb число обработанных мегабайт, в int2 размер текущего архива // filename: вызывается перед обработкой каждого файла // The main callback function for unpacking FreeArc archives function FreeArcCallback(what: PAnsiChar; Mb, int2: Integer; str: PAnsiChar): Integer; // вызывается не менее 100 раз в секунду, что заменяет вызов по таймеру begin case string(what) of 'origsize': origsize:= Mb; // данных в тек. архиве (при распаковке не вызывается) 'total_files': Null; 'filename': begin // Update FileName label WizardForm.FileNameLabel.Caption:= OemToAnsiStr(str); // извлекаемый файл, их имена пишутся в журнал установки FileNameLabel.Caption:= OemToAnsiStr(str); // извлекаемый файл, их имена пишутся в журнал установки Status.count:= Status.count + 1; // кол-во файлов, этап распаковки end; 'read': // позиция в текущем архиве Status.mb:= Mb; 'write': // Assign to Mb *total* amount of data extracted to the moment from all archives lastMb:= Mb; // извлечено из текущего архива end; if WizardForm.CurPageID = wpInstalling then UpdateStatus(0); // обновить страницу установки, не сбрасывая таймер if (GetKeyState(VK_ESCAPE) < 0) and not CancelDuringInstall then WizardForm.Close; // опрашиваем Cancel (если разрешена отмена установки) AppProcessMessage; Result:= CancelCode; end; Function ArcDecode(Line: string): array of TArc; // разбор строки Archives var tmp, cut: array of String; n, i: integer; Begin SetArrayLength(result,0); if Line <> '' then tmp:= StringToArray(Line,'|') else Exit; for n:= 0 to GetArrayLength(tmp) - 1 do begin if tmp[n][Length(tmp[n])] = '?' then Continue; // эта запись обрабатывается в AfterInstall: UnArc(...) SetArrayLength(result, GetArrayLength(result) +1); i:= GetArrayLength(result) -1; cut:= StringToArray(tmp[n],'>') // задачи, логика or and not наверное не будет работать if GetArrayLength(cut) > 1 then result[i].task:= cut[1]; cut:= StringToArray(cut[0],'<') // компоненты if GetArrayLength(cut) > 1 then result[i].comp:= cut[1]; cut:= StringToArray(cut[0],'/') // папка распаковки if GetArrayLength(cut) > 1 then result[i].Dest:= cut[1] else result[i].Dest:= '{app}'; // по-умолчанию if (ExtractFileDrive(ExpandENV(cut[0])) = '') and (ExpandENV(cut[0]) = cut[0]) then // строка вида Rus\*.arc result[i].Path:= '{src}\'+ cut[0] else result[i].Path:= cut[0]; // остаток от исходной строки result[i].Dest:= ExpandENV(result[i].Dest); result[i].Path:= ExpandENV(result[i].Path); end; End; // Scans the specified folders for archives and add them to list function AddArcs(files, target: string): Integer; // добавление архивов в общий список и подсчёт объёма распакованных данных var FSR: TFindRec; i: integer; Begin Result:= 0; if FindFirst(ExpandENV(files), FSR) then try repeat // Skip everything but the folders if FSR.Attributes and FILE_ATTRIBUTE_DIRECTORY > 0 then CONTINUE; // Expand the folder list i:= GetArrayLength(Arcs); SetArrayLength(Arcs, i +1); Arcs[i].Dest:= target; // путь распаковки для найденных по маске архивов Arcs[i].Path:= ExtractFilePath(ExpandENV(files)) + FSR.Name; Arcs[i].Size:= Size64(FSR.SizeHigh, FSR.SizeLow); Status.allsize:= Status.allsize + Arcs[i].Size; // зарезервировано для подсчёта прогресса распаковки 7-zip архивов (is7z.dll) Arcs[i].allMb:= FreeArcCmd(WrapFreeArcCallback(@FreeArcCallback,4),'l','--',AnsiToUtf8(Arcs[i].Path),'','','','','','',''); // код ошибки if Arcs[i].allMb >= 0 then begin Arcs[i].allMb:= origsize; result:= result + Arcs[i].allMb; // размер распакованных данных успешно считан end; until not FindNext(FSR); finally FindClose(FSR); end; End; function UnPackArchive(Source, Destination: string; allMb, Mode: Integer): Integer; var callback: longword; Begin // если отмена установки разрешена, кнопка Cancel станет доступна WizardForm.CancelButton.Enabled:= not CancelDuringInstall; callback:= WrapFreeArcCallback(@FreeArcCallback,4); //FreeArcCallback has 4 arguments Result:= FreeArcCmd(callback,'x','-o+','-dp'+AnsiToUtf8(Destination),'--',AnsiToUtf8(Source),'','','','',''); // код ошибки // Error occured if Result = 0 then Exit; msgError:= FmtMessage(cm('ArcError'), [IntToStr(Result)]); WizardForm.StatusLabel.Caption:= msgError; WizardForm.FileNameLabel.Caption:= ExtractFileName(Source); GetSpaceOnDisk(ExtractFileDrive(Destination), True, FreeMB, TotalMB); case Result of -1: if FreeMB < allMb {Мб на диске} then msgError:= SetupMessage(msgDiskSpaceWarningTitle) else msgError:= msgError + #13#10 + FmtMessage(cm('ArcBroken'), [ExtractFileName(Source)]); -127: msgError:= cm('ArcBreak'); //Cancel button -63: msgError:= cm('ArcFail'); end; Log(msgError); // записываем ошибку в лог, а также показываем её текст на странице завершения End; // Extracts all found archives function UnPack(Archives: string): Integer; begin // UpdateStatus(1); // остановить таймер Records:= ArcDecode(Archives); SetArrayLength(Arcs,0); Status.allsize:= 0; {общий объём} for n:= 0 to GetArrayLength(Records) -1 do // Get the size of all archives if (not IsTaskSelected(Records[n].task) and (Records[n].task <>'')) and (not IsComponentSelected(Records[n].comp) and (Records[n].comp <>'')) then Continue // компоненты и задачи не выбраны else totalUncompressedSize:= totalUncompressedSize + AddArcs(Records[n].Path, Records[n].Dest); // создаём список архивов // Other initializations WizardForm.StatusLabel.Caption:= cm('ArcTitle'); // начало этапa распаковки ExtractFile.Show; ProgressBar.Show; baseMb:= 0; lastMb:= 0; Status.mb:= 0; // обнулить полученные мегабайты, если ранее вёлся подсчёт объёма файлов инсталлятора Status.count:= 0; // не учитывать файлы, извлечённые инсталлятором UpdateStatus(7); // немедленно обновить строку статуса for ArcInd:= 0 to GetArrayLength(Arcs) -1 do begin // архивы в текущей папке, константы раскрыты в ArcDecode Result:= UnPackArchive(Arcs[ArcInd].Path, Arcs[ArcInd].Dest, Arcs[ArcInd].allMb, 0); // код ошибки if Result <> 0 then Break; // прервать цикл распаковки baseMb:= baseMb + lastMb; lastMb:= 0; Status.mb:= 0; // общий объём распакованных файлов // отработанный архив автоматически удаляется, если находится в папке {app} или {tmp} if (Pos(AnsiLowercase(ExpandConstant('{app}')), AnsiLowercase(Arcs[ArcInd].Path)) > 0) or (Pos(AnsiLowercase(ExpandConstant('{tmp}')), AnsiLowercase(Arcs[ArcInd].Path)) > 0) then DeleteFile(Arcs[ArcInd].Path); end; if Result = 0 then WizardForm.StatusLabel.Caption:= FmtMessage(cm('ArcFinish'), [IntToStr(GetArrayLength(Arcs)), IntToStr(Status.count), ByteOrTB(Status.size*oneMB, true)]); StatusInfo.Hide; ExtractFile.Hide; ProgressBar.Hide; end; procedure CurStepChanged2(CurStep: TSetupStep); begin if CurStep = ssInstall then begin StartInstall:= GetTickCount {время начала извлечения файлов} WndHookID:= SetWindowsHookEx(WH_CALLWNDPROC, WrapCWPSTRUCTProc(@OnWndHook, 3), 0, GetCurrentThreadID); {установка SendMessage хука} TimerID:= SetTimer(0, 0, 500 {полсекунды}, WrapTimerProc(@MyTimerProc, 4)); {установка таймера} if not {#isFalse(SetupSetting("Uninstallable"))} then Status.count:= -1; // не считать файл unins000.exe end; if CurStep = ssPostInstall then begin StartInstall:= GetTickCount {время начала распаковки} UnPackError:= UnPack('{#Archives}') if UnPackError <> 0 then begin // Error occured, uninstall it then if not {#isFalse(SetupSetting("Uninstallable"))} then // деинсталляция разрешёна Exec(ExpandConstant('{uninstallexe}'), '/SILENT','', sw_Hide, ewWaitUntilTerminated, n); // откат установки из-за ошибки unarc.dll WizardForm.caption:= SetupMessage(msgErrorTitle) +' - '+ cm('ArcBreak') SetTaskBarTitle(SetupMessage(msgErrorTitle)) end else SetTaskBarTitle(SetupMessage(msgSetupAppTitle)); end; end; Procedure SetTexture(CurPageID: Integer); // на каждой странице своя картинка Begin WizardForm.Bevel1.Visible:= (WizardForm.CurPageID <> wpWelcome) and (WizardForm.CurPageID <> wpFinished); WizardForm.Bevel1.Parent:= WizardForm.OuterNotebook.ActivePage Texture.Parent:= WizardForm.InnerNotebook.ActivePage; Texture.SendToBack; Texture.Visible:= CurPageID = wpInstalling; Texture2.Visible:= Texture.Visible; End; Procedure CurPageChanged2(CurPageID: Integer); Begin SetTexture(CurPageID) if (CurPageID = wpFinished) and (UnPackError <> 0) then begin // Extraction was unsuccessful (распаковщик вернул ошибку) // Show error message WizardForm.FinishedLabel.Font.Color:= $0000C0; // red (красный) WizardForm.FinishedLabel.Height:= WizardForm.FinishedLabel.Height * 2; WizardForm.FinishedLabel.Caption:= SetupMessage(msgSetupAborted) + #13#10#13#10 + msgError; end; End; procedure WizardClose(Sender: TObject; var Action: TCloseAction); Begin Action:= caNone; // так надо if Status.stage = cm('ArcTitle') then begin // распаковка на этапе ssPostInstall UpdateStatus(1); // остановить таймер if MsgBox(SetupMessage(msgExitSetupMessage), mbInformation, MB_YESNO) = IDYES then CancelCode:= -127; // прервать распаковку UpdateStatus(7); // обновить информацию end else MainForm.Close; // стандартное нажатие кнопки закрытия окна, отмены или Escape. End; Procedure InitializeWizard2(); Begin // Create controls to show extended info FileNameLabel:= CreateLabel(WizardForm.InstallingPage,false,false,true,'',[],0,0,0,0,0, WizardForm.FileNameLabel); WizardForm.StatusLabel.Top:= WizardForm.ProgressGauge.Top; WizardForm.FileNameLabel.Top:= WizardForm.ProgressGauge.Top; // прячем под прогрессбар, тогда все события WM_PAINT перехватываются with WizardForm.ProgressGauge do begin StatusInfo:= CreateLabel(WizardForm.InstallingPage, false, true, true, '', [], 0, 0, Top + ScaleY(32), Width, 0, Nil); ProgressBar := TNewProgressBar.Create(WizardForm); ProgressBar.SetBounds(Left, StatusInfo.Top + StatusInfo.Height + ScaleY(16), Width, Height); ProgressBar.Parent := WizardForm.InstallingPage; ProgressBar.max := 65536; ProgressBar.Hide; // будет показан при обработке нескольких архивов ExtractFile:= CreateLabel(WizardForm.InstallingPage, false, true, true, '', [], 0, 0, ProgressBar.Top + ScaleY(32), Width, 0, Nil); end; WizardForm.OnClose:= @WizardClose // позволяет прервать распаковку архивов стандартными способами // фоновая графика Texture:= TBitmapImage.Create(WizardForm); Texture.SetBounds(-WizardForm.InnerNotebook.Left, -WizardForm.InnerNotebook.Top, WizardForm.ClientWidth, WizardForm.ClientHeight); GradientFill(Texture, BackColor, EndColor); // вместо градиента можно загрузить картинку Texture2:= TBitmapImage.Create(WizardForm); Texture2.SetBounds(0, 0, WizardForm.ClientWidth, WizardForm.ClientHeight); Texture2.Parent:= WizardForm.InnerPage; Texture2.Bitmap:= Texture.Bitmap; End; Procedure DeInitializeSetup1; Begin KillTimer(0, TimerID) {удаление таймера} UnhookWindowsHookEx(WndHookID) {удаление SendMessage хука} ShowWindow(StrToInt(ExpandConstant('{wizardhwnd}')), 0); UnloadSkin(); BASS_Free(); //Запуск файла после установки if (PageID=wpFinished) and (RunProgram.Checked) then Exec(ExpandConstant('{#AppRunningFile}'), '', '', SW_SHOWNORMAL, ewNoWait, ResultCode); //Запускает файл если на финишной странице выбран чекбокс End; //******************************************* [Конец - FreArc] ***************************************************// Procedure InitializeWizard(); Begin InitializeWizard1(); InitializeWizard2(); End; procedure CurStepChanged(CurStep: TSetupStep); begin CurStepChanged1(CurStep); CurStepChanged2(CurStep); End; procedure CurPageChanged(CurPageID: Integer); begin CurPageChanged1(CurPageID); CurPageChanged2(CurPageID); End; [UninstallDelete] Type: filesandordirs; Name: {app}; | Всего записей: 100 | Зарегистр. 18-03-2009 | Отправлено: 19:17 16-12-2009 | Исправлено: AngelDead, 19:18 16-12-2009 |
|