|
Компьютерный форум OSzone.net » Автоматическая установка Windows » Автоматическая установка приложений » Скрипты Inno Setup. Помощь и советы [часть 8] |
|
Скрипты Inno Setup. Помощь и советы [часть 8]
|
Ветеран Сообщения: 1264 |
Профиль | Отправить PM | Цитировать
Внимание! Данная тема предназначена только для обсуждения написания скриптов !
Остальные вопросы, а также последние версии компилятора в теме Inno Setup. Прочие вопросы. Показать/скрыть: Справка, руководство, примеры:
Показать/скрыть: Ссылки на примеры скриптов:
Показать/скрыть: Дополнительные программы для Inno Setup:
Предыдущие ветки обсуждения по ссылкам ниже и в прикреплённых архивах: Скрипты Inno Setup. Помощь и советы (Archive Pack 1):
Скрипты Inno Setup. Помощь и советы [часть 6] Скрипты Inno Setup. Помощь и советы [часть 7] |
|
Отправлено: 08:52, 02-02-2015 |
SHVtYW4= Сообщения: 3451
|
Профиль | Отправить PM | Цитировать
Цитата vk_k14m@vk:
P.S У меня Inno Setup версии 5.5.1. Для обычной версии Inno Setup подойдёт этот пример из справки: Скрытый текст
Файл dll прикрепил выше. [Setup] AppName=My Program AppVerName=My Program 1.5 DefaultDirName={pf}\My Program DefaultGroupName=My Program [Languages] Name: english; MessagesFile: compiler:Default.isl Name: russian; MessagesFile: compiler:Languages\Russian.isl [CustomMessages] english.ComponentsName1=My program™ russian.ComponentsName1=Моя программа™ english.ComponentsName1_1=English version russian.ComponentsName1_1=Английская версия english.ComponentsName1_2=Russian version russian.ComponentsName1_2=Русская версия english.ComponentsName2=Help russian.ComponentsName2=Помощь english.ComponentsName2_1=Documentation russian.ComponentsName2_1=Документация english.ComponentsName2_2=User manual russian.ComponentsName2_2=Руководство пользователя english.ComponentsInfoPanel1=Description russian.ComponentsInfoPanel1=Описание english.ComponentsInfoPanel2=Direct the cursor a mouse on component to read his description. russian.ComponentsInfoPanel2=Наведите курсор мыши на компонент, чтобы прочитать его описание. english.ComponentsDescription1=Necessarily is fixed russian.ComponentsDescription1=Устанавливается обязательно english.ComponentsDescription2=Install english version russian.ComponentsDescription2=Установить английскую версию english.ComponentsDescription3=Install russian version russian.ComponentsDescription3=Установить русскую версию english.ComponentsDescription4=Help russian.ComponentsDescription4=Помощь english.ComponentsDescription5=Read documentation russian.ComponentsDescription5=Прочитать документацию english.ComponentsDescription6=Read user manual russian.ComponentsDescription6=Прочитать руководство пользователя [Components] Name: main; Description: {cm:ComponentsName1}; Types: full custom; Flags: fixed Name: main\english; Description: {cm:ComponentsName1_1}; Flags: exclusive Name: main\russian; Description: {cm:ComponentsName1_2}; Flags: exclusive Name: help; Description: {cm:ComponentsName2}; Types: full custom Name: help\documentation; Description: {cm:ComponentsName2_1}; Types: full custom Name: help\manual; Description: {cm:ComponentsName2_2}; Types: full custom [Files] Source: "MyProg.exe"; DestDir: "{app}"; Components: main Source: "MyProg.chm"; DestDir: "{app}"; Components: help Source: "descctrl.dll"; Flags: dontcopy [Messages] ComponentsDiskSpaceMBLabel= [Code] function enabledesc(ComponentsListHandle: HWND; DescLabelHandle: HWND; DescStrings: PChar): BOOL; external 'enabledesc@files:descctrl.dll stdcall'; function disabledesc(): BOOL; external 'disabledesc@files:descctrl.dll stdcall'; var Info: TNewStaticText; InfoCaption: TNewStaticText; InfoPanel: TPanel; procedure DeinitializeSetup(); begin disabledesc(); end; procedure InitializeWizard(); begin WizardForm.TypesCombo.Visible:=False; WizardForm.ComponentsList.Height := ScaleY(181) - WizardForm.TypesCombo.Top; WizardForm.ComponentsList.Top := WizardForm.TypesCombo.Top; WizardForm.ComponentsList.Width := ScaleX(417); InfoPanel := TPanel.Create(WizardForm); InfoPanel.Parent := WizardForm.SelectComponentsPage; InfoPanel.Caption := ''; InfoPanel.Top := ScaleY(190); InfoPanel.Left := ScaleX(0); InfoPanel.Width := ScaleX(417); InfoPanel.Height := ScaleY(38); InfoPanel.BevelInner := bvRaised; InfoPanel.BevelOuter := bvLowered; InfoCaption := TNewStaticText.Create(WizardForm); InfoCaption.Parent := WizardForm.SelectComponentsPage; InfoCaption.Caption := ExpandConstant('{cm:ComponentsInfoPanel1}'); InfoCaption.Left := ScaleX(7); InfoCaption.Top := InfoPanel.Top - ScaleY(6); InfoCaption.Font.Color := clActiveCaption; Info := TNewStaticText.Create(WizardForm); Info.Parent := InfoPanel; Info.AutoSize := False; Info.Left := ScaleX(6); Info.Width := ScaleX(403); Info.Top := ScaleY(12); Info.Height := ScaleY(24); Info.Caption := ExpandConstant('{cm:ComponentsInfoPanel2}'); Info.WordWrap := true; enabledesc(WizardForm.ComponentsList.Handle,Info.Handle, ExpandConstant('{cm:ComponentsDescription1};')+ ExpandConstant('{cm:ComponentsDescription2};')+ ExpandConstant('{cm:ComponentsDescription3};')+ ExpandConstant('{cm:ComponentsDescription4};')+ ExpandConstant('{cm:ComponentsDescription5};')+ ExpandConstant('{cm:ComponentsDescription6};') ); end; |
|||||
------- Отправлено: 19:17, 09-10-2017 | #2191 |
Для отключения данного рекламного блока вам необходимо зарегистрироваться или войти с учетной записью социальной сети. Если же вы забыли свой пароль на форуме, то воспользуйтесь данной ссылкой для восстановления пароля. |
Старожил Сообщения: 342
|
Профиль | Отправить PM | Цитировать Цитата Nordek:
Скрытый текст
В самом коде же не надо ничего менять? Скрытый текст
; Этот сценарий создан с помощью Мастера Inno Setup. ; ОБРАТИТЕСЬ К СПРАВОЧНОЙ ДОКУМЕНТАЦИИ, ЧТОБЫ ИСПОЛЬЗОВАТЬ ВСЕ ВОЗМОЖНОСТИ INNO SETUP! #define MyAppName "Artificial Academy 2" #define MyAppVersion "2.0.1.0" #define MyAppPublisher "Illusion" #define MyAppExeName "AA2Play.exe" [Setup] ; Примечание: Значение AppId является уникальным идентификатором для этого приложения. ; Не используйте одно и тоже значение AppId для разных приложений. ; (Для создания нового значения GUID, выберите в меню "Инструменты" пункт "Создать GUID".) AppId={{37EDDB6D-1F9B-474F-8FF4-57CC8277B1A7} AppName={#MyAppName} AppVersion={#MyAppVersion} ;AppVerName={#MyAppName} {#MyAppVersion} AppPublisher={#MyAppPublisher} DefaultDirName=D:\Games\{#MyAppName} DefaultGroupName={#MyAppName} AllowNoIcons=yes OutputDir=D:\Inno Setup OutputBaseFilename=setup DisableWelcomePage=no SetupIconFile=D:\Inno Setup\Installer\ico.ico WizardImageFile=D:\Inno Setup\Installer\WizardImage.bmp WizardSmallImageFile=D:\Inno Setup\Installer\WizardSmallImage.bmp Compression=lzma2/ultra64 SolidCompression=yes DiskSpanning=yes DiskSliceSize=1536000000 [Languages] Name: "russian"; MessagesFile: "compiler:\Languages\Russian.isl" [Tasks] Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked [Types] Name: "Main"; Description: "Установка чистой игры с русификатором" Name: "MKIII"; Description: "Полная установка с антицензором MKIII" Name: "SVII"; Description: "Полная установка с антицензором SVII"; Name: "custom"; Description: "Выборочная установка"; Flags: iscustom [CustomMessages] russian.ComponentsName1=Artificial Academy 2 +русификатор v.3 russian.ComponentsName2=Антицензор russian.ComponentsName2a=МКIII russian.ComponentsName2a1=Пак одежды для MKIII анцензора russian.ComponentsName2a2=Аддон на подвязки ... russian.ComponentsInfoPanel1=Описание russian.ComponentsInfoPanel2=Наведите курсор мыши на компонент, чтобы прочитать его описание. russian.ComponentsDescription1=Чистая версия игры со всеми фиксами и ДЛС +русификатор v.3 (для чистой игры) russian.ComponentsDescription2=Выберите один из антицензоров russian.ComponentsDescription2a=Антицензорв MKIII - [AA2][Uncensor][3D MK-III][FA][v2.0][Various] russian.ComponentsDescription2a1=Мод на одежду - [AA2][HEXA Clothing Collection][MK-III][v5.2][Various] russian.ComponentsDescription2a2= ... [Components] Name: "Main"; Description: {cm:ComponentsName1}; Types: Main MKIII SVII custom; Name: "Anticensor"; Description: {cm:ComponentsName2}; Types: custom Name: "Anticensor\MKIII"; Description: {cm:ComponentsName2a}; Types: MKIII custom; Flags: exclusive Name: "Anticensor\MKIII\clothes"; Description: {cm:ComponentsName2a1}; Types: MKIII custom; Flags: exclusive Name: "Anticensor\MKIII\clothes\garter_belt"; Description: {cm:ComponentsName2a2}; Types: MKIII custom; ... [Files] Source: "D:\Inno Setup\Installer\0 Delete after install\AA2Decrypt_unpack.bat"; DestDir: "{app}"; BeforeInstall: ChangeCaption('Подготовка к установке (Распаковка *.рр архивов)'); AfterInstall: install_this_file_1; Flags: ignoreversion recursesubdirs createallsubdirs deleteafterinstall solidbreak Source: "D:\Inno Setup\Installer\1 Artificial Academy 2\Artificial Academy 2*"; DestDir: "{app}"; BeforeInstall: ChangeCaption('Установка основных файлов игры'); Components: Main; Flags: ignoreversion recursesubdirs createallsubdirs sortfilesbyextension ... Source: "D:\Inno Setup\Installer\descctrl.dll"; Flags: dontcopy ; Примечание: Не используйте' флаги "ignoreversion" для общих системных файлов. [Сode] function enabledesc(ComponentsListHandle: HWND; DescLabelHandle: HWND; DescStrings: PChar): BOOL; external 'enabledesc@files:descctrl.dll stdcall'; function disabledesc(): BOOL; external 'disabledesc@files:descctrl.dll stdcall'; var Info: TNewStaticText; InfoCaption: TNewStaticText; InfoPanel: TPanel; procedure DeinitializeSetup(); begin disabledesc(); end; procedure InitializeWizard(); begin WizardForm.TypesCombo.Visible:=False; WizardForm.ComponentsList.Height := ScaleY(181) - WizardForm.TypesCombo.Top; WizardForm.ComponentsList.Top := WizardForm.TypesCombo.Top; WizardForm.ComponentsList.Width := ScaleX(417); InfoPanel := TPanel.Create(WizardForm); InfoPanel.Parent := WizardForm.SelectComponentsPage; InfoPanel.Caption := ''; InfoPanel.Top := ScaleY(190); InfoPanel.Left := ScaleX(0); InfoPanel.Width := ScaleX(417); InfoPanel.Height := ScaleY(38); InfoPanel.BevelInner := bvRaised; InfoPanel.BevelOuter := bvLowered; InfoCaption := TNewStaticText.Create(WizardForm); InfoCaption.Parent := WizardForm.SelectComponentsPage; InfoCaption.Caption := ExpandConstant('{cm:ComponentsInfoPanel1}'); InfoCaption.Left := ScaleX(7); InfoCaption.Top := InfoPanel.Top - ScaleY(6); InfoCaption.Font.Color := clActiveCaption; Info := TNewStaticText.Create(WizardForm); Info.Parent := InfoPanel; Info.AutoSize := False; Info.Left := ScaleX(6); Info.Width := ScaleX(403); Info.Top := ScaleY(12); Info.Height := ScaleY(24); Info.Caption := ExpandConstant('{cm:ComponentsInfoPanel2}'); Info.WordWrap := true; enabledesc(WizardForm.ComponentsList.Handle,Info.Handle, ExpandConstant('{cm:ComponentsDescription1};')+ ExpandConstant('{cm:ComponentsDescription2};')+ ExpandConstant('{cm:ComponentsDescription3};')+ ExpandConstant('{cm:ComponentsDescription4};')+ ExpandConstant('{cm:ComponentsDescription5};')+ ExpandConstant('{cm:ComponentsDescription6};') ); end; ... [Icons] Name: "{group}\{#MyAppName}"; Components: Main; Filename: "{app}\{#MyAppExeName}" Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Components: Main; Filename: "{uninstallexe}" Name: "{commondesktop}\{#MyAppName}"; Components: Main; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon |
|
------- Отправлено: 01:47, 10-10-2017 | #2192 |
Старожил Сообщения: 440
|
Профиль | Сайт | Отправить PM | Цитировать |
------- Отправлено: 05:26, 10-10-2017 | #2193 |
Старожил Сообщения: 342
|
Профиль | Отправить PM | Цитировать Цитата Nordek:
Или справа от компонента знак [?] поставить, при нажатии на который высветится описание. |
|
------- Отправлено: 06:16, 10-10-2017 | #2194 |
Новый участник Сообщения: 12
|
Профиль | Отправить PM | Цитировать Добрый день!
В зависимости от выбранного компонента, создаётся страница задач с двумя чекбоксами. На страницу с задачами надо добавить возможность выбора папки для установки некоторых файлов, для определённой задачи. Я пытался сделать, но всё что нашел CreateInputDirPage(wpSelectTasks,...), т.е. после страницы задач создаётся страница выбора папки. А ведь надо эту возможность поместить именно на страницу wpSelectTasks и выровнять с учётом расположения имеющихся на ней чекбоксов. Как это сделать? |
Отправлено: 11:31, 15-10-2017 | #2195 |
Новый участник Сообщения: 42
|
Профиль | Отправить PM | Цитировать парни помогите соединить 2 скрипта вместе
1 скрипт
2 скрипт
procedure ShowSplashScreen(p1:HWND;p2:AnsiString;p3,p4,p5,p6,p7:integer;p8:boolean;p9:Cardinal;p10:integer); external 'ShowSplashScreen@files:isgsg.dll stdcall delayload'; procedure RunSplash(); begin ExtractTemporaryFile('splash.gif'); ShowSplashScreen(WizardForm.Handle,ExpandConstant('{tmp}')+'\splash.gif',{#SplS},{#SplR},{#SplE},0,255,False,$FFFFFF,10); end; #define A = (Defined UNICODE) ? "W" : "A" const WM_USER = $0400; PBM_SETPOS = (WM_USER + 2); GWL_WNDPROC = (-4); GWL_USERDATA = (-21); function GetWindowLong(hWnd: HWND; nIndex: Integer): Longint; external 'GetWindowLong{#A}@user32.dll stdcall'; function SetWindowLong(hWnd: HWND; nIndex: Integer; dwNewLong: Longint): Longint; external 'SetWindowLong{#A}@user32.dll stdcall'; function CallWindowProc(lpPrevWndFunc: Longint; hWnd: HWND; Msg: UINT; wParam: Longint; lParam: Longint): Longint; external 'CallWindowProc{#A}@user32.dll stdcall'; function MulDiv(nNumber, nNumerator, nDenominator: Integer): Integer; external 'MulDiv@kernel32.dll stdcall'; var InstPercentLabel: TLabel; /////////////////////////////// procedure CreateInstallingPage; begin { InstPercentLabel } InstPercentLabel := TLabel.Create(WizardForm); with InstPercentLabel do begin Parent := WizardForm.ProgressGauge; Align := alClient; Alignment := taCenter; Layout := tlCenter; Transparent := True; end; end; /////////////////////////////////////////////////////////////////////////////////////// function ProgressGaugeWndProc(hWnd: HWND; Msg: UINT; wParam, lParam: Longint): Longint; begin case Msg of PBM_SETPOS: begin Result := CallWindowProc(GetWindowLong(hWnd, GWL_USERDATA), hWnd, Msg, wParam, lParam); with WizardForm.ProgressGauge do InstPercentLabel.Caption := Format('%d %%', [MulDiv(Position, 100, Max)]); end; else Result := CallWindowProc(GetWindowLong(hWnd, GWL_USERDATA), hWnd, Msg, wParam, lParam); end; end; /////////////////////////// procedure SubclassControls; begin { ProgressGauge } with WizardForm.ProgressGauge do begin if GetWindowLong(Handle, GWL_USERDATA) = 0 then SetWindowLong(Handle, GWL_USERDATA, SetWindowLong(Handle, GWL_WNDPROC, CallbackAddr('ProgressGaugeWndProc'))); end; end; /////////////////////////// procedure InitializeWizard3; begin CreateInstallingPage; SubclassControls; end; ///////////////////////////// procedure UnSubclassControls; begin { ProgressGauge } with WizardForm.ProgressGauge do begin if GetWindowLong(Handle, GWL_USERDATA) > 0 then SetWindowLong(Handle, GWL_WNDPROC, GetWindowLong(Handle, GWL_USERDATA)); end; end; function GetSystemMetrics(nIndex:Integer):integer; external 'GetSystemMetrics@user32.dll stdcall delayload'; procedure InitializeWizard2(); begin WizardForm.CancelButton.BringToFront; WizardForm.Bevel1.Hide; end; procedure CurPageChanged(CurPageID: Integer); begin if CurPageID=wpInstalling then begin WizardForm.BorderStyle:=bsDialog; WizardForm.MainPanel.Visible:=False; WizardForm.Width:=ScaleX(320); WizardForm.Height:=ScaleY(91); WizardForm.InnerNotebook.Left:=ScaleX(7); WizardForm.InnerNotebook.Top:=ScaleY(7); WizardForm.InnerNotebook.Width:=ScaleX(300); 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(17); WizardForm.FileNameLabel.Width:=WizardForm.InnerNotebook.Width; WizardForm.ProgressGauge.Top:=ScaleY(15); WizardForm.ProgressGauge.Left:=ScaleX(0); WizardForm.ProgressGauge.Width:=WizardForm.InnerNotebook.Width; WizardForm.CancelButton.Left:=ScaleX(122); WizardForm.CancelButton.Top:=ScaleY(70); WizardForm.Left:=GetSystemMetrics(16)-ScaleX(325); WizardForm.Top:=GetSystemMetrics(17)-ScaleX(68); end; if CurPageID=wpFinished then begin WizardForm.Width:=502; WizardForm.Height:=392; WizardForm.Position:=poScreenCenter; end; end; //////////////////////// var Label1: TLabel; procedure btnOnClick(Sender: TObject); var rcode: integer; begin ShellExec('open','','', '', SW_SHOW, ewNoWait, rCode); end; procedure btnOnClick2(Sender: TObject); begin Label1.Font.Color := clred; end; procedure btnOnClick3(Sender: TObject); begin Label1.Font.Color := clBlue; end; procedure InitializeWizard4(); begin Label1 := TLabel.Create(WizardForm); with Label1 do begin Parent := WizardForm; Cursor := crHand; Caption := 'софт'; Font.Color := clBlue; Font.Height := -16; Font.Name := 'Tahoma'; Font.Style := [fsUnderline]; ParentFont := False; Transparent := True; OnClick := @btnOnClick; OnMouseEnter := @btnOnClick2; OnMouseLeave := @btnOnClick3; Left := ScaleX(8); Top := ScaleY(327); Width := ScaleX(153); Height := ScaleY(19); end; end; ///////////////// const BtnClickEventID = 1; type #ifndef UNICODE AnsiChar = Char; #endif TBtnEventProc = procedure(h:HWND); var MusicButton, mp3Handle: HWND; function WrapBtnCallback(Callback: TBtnEventProc; ParamCount: Integer): Longword; external 'wrapcallbackaddr@{tmp}\CallbackCtrl.dll stdcall delayload'; function BtnGetChecked(h:HWND):boolean; external 'BtnGetChecked@{tmp}\botva2.dll stdcall delayload'; function BtnCreate(hParent:HWND; Left,Top,Width,Height:integer; FileName:PAnsiChar; ShadowWidth:integer; IsCheckBtn:boolean):HWND; external 'BtnCreate@{tmp}\botva2.dll stdcall delayload'; procedure BtnSetCursor(h:HWND; hCur:Cardinal); external 'BtnSetCursor@{tmp}\botva2.dll stdcall delayload'; function GetSysCursorHandle(id:integer):Cardinal; external 'GetSysCursorHandle@{tmp}\botva2.dll stdcall delayload'; procedure BtnSetEvent(h:HWND; EventID:integer; Event:Longword); external 'BtnSetEvent@{tmp}\botva2.dll stdcall delayload'; procedure BtnSetVisibility(h:HWND; Value:boolean); external 'BtnSetVisibility@{tmp}\botva2.dll stdcall delayload'; procedure gdipShutdown; external 'gdipShutdown@{tmp}\botva2.dll stdcall delayload'; procedure ImgApplyChanges(h:HWND); external 'ImgApplyChanges@{tmp}\botva2.dll stdcall delayload'; Function BASS_Init(device: Integer; freq, flags: DWORD; win: hwnd; CLSID: Integer): Boolean; external 'BASS_Init@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_Stop: Boolean; external 'BASS_Stop@files:BASS.dll stdcall delayload'; Function BASS_Free: Boolean; external 'BASS_Free@files:BASS.dll stdcall delayload'; Function BASS_StreamCreateFileLib(MEM: BOOL; fil: PAnsiChar; offset, length, flags: DWORD): DWORD; external 'BASS_StreamCreateFile@{tmp}\bp.dll stdcall delayload'; Function BASS_StreamCreateFile(MEM: BOOL; fil: AnsiString; offset, flags: DWORD): DWORD; var Size: Longint; Buffer: ansistring; begin if MEM then begin Size:= ExtractTemporaryFileSize(fil); SetLength(Buffer,Size); ExtractTemporaryFileToBuffer(fil, Cast{#defined UNICODE ? "Ansi" : ""}StringToInteger(Buffer)); Result:= BASS_StreamCreateFileLib(MEM, Buffer, 0, Size, flags); end else Result:= BASS_StreamCreateFileLib(MEM, fil, offset, 0, flags); end; Procedure MusicButtonClick(hBtn:HWND); begin if BtnGetChecked(MusicButton) then BASS_ChannelPause(mp3Handle) else if BASS_ChannelIsActive(mp3Handle) = 3 then BASS_ChannelPlay(mp3Handle, False); end; function InitializeSetup(): Boolean; begin if not FileExists(ExpandConstant('{tmp}\Bass.dll')) then ExtractTemporaryFile('Bass.dll'); if not FileExists(ExpandConstant('{tmp}\BP.dll')) then ExtractTemporaryFile('BP.dll'); if not FileExists(ExpandConstant('{tmp}\botva2.dll')) then ExtractTemporaryFile('botva2.dll'); if not FileExists(ExpandConstant('{tmp}\CallbackCtrl.dll')) then ExtractTemporaryFile('CallbackCtrl.dll'); if not FileExists(ExpandConstant('{tmp}\MusicButton.png')) then ExtractTemporaryFile('MusicButton.png'); Result:=True; end; Procedure InitializeWizard5(); begin MusicButton:=BtnCreate(WizardForm.Handle,ScaleX(170),ScaleY(320),ScaleX(35),ScaleY(35),ExpandConstant('{tmp}\MusicButton.png'),1,True); BtnSetCursor(MusicButton, GetSysCursorHandle(32649)); BtnSetEvent(MusicButton, BtnClickEventID, CallBackAddr('MusicButtonClick')); BtnSetVisibility(MusicButton, True); BASS_Init(-1, 44100, 0, 0, 0); mp3Handle:= BASS_StreamCreateFile(TRUE, 'Music.mp3', 0, 4); BASS_Start; BASS_ChannelPlay(mp3Handle, False); ImgApplyChanges(WizardForm.Handle); end; Procedure StopMusic(); begin BASS_Stop; BASS_Free; end; procedure InitializeWizard(); begin InitializeWizard2(); InitializeWizard3; InitializeWizard4(); RunSplash(); InitializeWizard5(); end; //////////////////////////// procedure DeinitializeSetup; begin if ExpandConstant('{wizardhwnd}') = '0' then Exit; UnSubclassControls; StopMusic(); gdipShutdown; end; |
Отправлено: 09:47, 21-10-2017 | #2196 |
SHVtYW4= Сообщения: 3451
|
Профиль | Отправить PM | Цитировать pollipen, На работоспособность не проверял, лень производить входящее содержимое (из рода: файлы, каталоги).
Скрытый текст
[Code] procedure ShowSplashScreen(p1:HWND;p2:AnsiString;p3,p4,p5,p6,p7:integer;p8:boolean;p9:Cardinal;p10:integer); external 'ShowSplashScreen@files:isgsg.dll stdcall delayload'; procedure RunSplash(); begin ExtractTemporaryFile('splash.gif'); ShowSplashScreen(WizardForm.Handle,ExpandConstant('{tmp}')+'\splash.gif',{#SplS},{#SplR},{#SplE},0,255,False,$FFFFFF,10); end; #define A = (Defined UNICODE) ? "W" : "A" const WM_USER = $0400; PBM_SETPOS = (WM_USER + 2); GWL_WNDPROC = (-4); GWL_USERDATA = (-21); function GetWindowLong(hWnd: HWND; nIndex: Integer): Longint; external 'GetWindowLong{#A}@user32.dll stdcall'; function SetWindowLong(hWnd: HWND; nIndex: Integer; dwNewLong: Longint): Longint; external 'SetWindowLong{#A}@user32.dll stdcall'; function CallWindowProc(lpPrevWndFunc: Longint; hWnd: HWND; Msg: UINT; wParam: Longint; lParam: Longint): Longint; external 'CallWindowProc{#A}@user32.dll stdcall'; function MulDiv(nNumber, nNumerator, nDenominator: Integer): Integer; external 'MulDiv@kernel32.dll stdcall'; var InstPercentLabel: TLabel; /////////////////////////////// procedure CreateInstallingPage; begin { InstPercentLabel } InstPercentLabel := TLabel.Create(WizardForm); with InstPercentLabel do begin Parent := WizardForm.ProgressGauge; Align := alClient; Alignment := taCenter; Layout := tlCenter; Transparent := True; end; end; /////////////////////////////////////////////////////////////////////////////////////// function ProgressGaugeWndProc(hWnd: HWND; Msg: UINT; wParam, lParam: Longint): Longint; begin case Msg of PBM_SETPOS: begin Result := CallWindowProc(GetWindowLong(hWnd, GWL_USERDATA), hWnd, Msg, wParam, lParam); with WizardForm.ProgressGauge do InstPercentLabel.Caption := Format('%d %%', [MulDiv(Position, 100, Max)]); end; else Result := CallWindowProc(GetWindowLong(hWnd, GWL_USERDATA), hWnd, Msg, wParam, lParam); end; end; /////////////////////////// procedure SubclassControls; begin { ProgressGauge } with WizardForm.ProgressGauge do begin if GetWindowLong(Handle, GWL_USERDATA) = 0 then SetWindowLong(Handle, GWL_USERDATA, SetWindowLong(Handle, GWL_WNDPROC, CallbackAddr('ProgressGaugeWndProc'))); end; end; ///////////////////////////// procedure UnSubclassControls; begin { ProgressGauge } with WizardForm.ProgressGauge do begin if GetWindowLong(Handle, GWL_USERDATA) > 0 then SetWindowLong(Handle, GWL_WNDPROC, GetWindowLong(Handle, GWL_USERDATA)); end; end; function GetSystemMetrics(nIndex:Integer):integer; external 'GetSystemMetrics@user32.dll stdcall delayload'; procedure CurPageChanged(CurPageID: Integer); begin if CurPageID=wpInstalling then begin WizardForm.BorderStyle:=bsDialog; WizardForm.MainPanel.Visible:=False; WizardForm.Width:=ScaleX(320); WizardForm.Height:=ScaleY(91); WizardForm.InnerNotebook.Left:=ScaleX(7); WizardForm.InnerNotebook.Top:=ScaleY(7); WizardForm.InnerNotebook.Width:=ScaleX(300); 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(17); WizardForm.FileNameLabel.Width:=WizardForm.InnerNotebook.Width; WizardForm.ProgressGauge.Top:=ScaleY(15); WizardForm.ProgressGauge.Left:=ScaleX(0); WizardForm.ProgressGauge.Width:=WizardForm.InnerNotebook.Width; WizardForm.CancelButton.Left:=ScaleX(122); WizardForm.CancelButton.Top:=ScaleY(70); WizardForm.Left:=GetSystemMetrics(16)-ScaleX(325); WizardForm.Top:=GetSystemMetrics(17)-ScaleX(68); end; if CurPageID=wpFinished then begin WizardForm.Width:=502; WizardForm.Height:=392; WizardForm.Position:=poScreenCenter; end; end; //////////////////////// var Label1: TLabel; procedure btnOnClick(Sender: TObject); var rcode: integer; begin ShellExec('open','','', '', SW_SHOW, ewNoWait, rCode); end; procedure btnOnClick2(Sender: TObject); begin Label1.Font.Color := clred; end; procedure btnOnClick3(Sender: TObject); begin Label1.Font.Color := clBlue; end; ///////////////// const BtnClickEventID = 1; type #ifndef UNICODE AnsiChar = Char; #endif TBtnEventProc = procedure(h:HWND); var MusicButton, mp3Handle: HWND; function WrapBtnCallback(Callback: TBtnEventProc; ParamCount: Integer): Longword; external 'wrapcallbackaddr@{tmp}\CallbackCtrl.dll stdcall delayload'; function BtnGetChecked(h:HWND):boolean; external 'BtnGetChecked@{tmp}\botva2.dll stdcall delayload'; function BtnCreate(hParent:HWND; Left,Top,Width,Height:integer; FileName:PAnsiChar; ShadowWidth:integer; IsCheckBtn:boolean):HWND; external 'BtnCreate@{tmp}\botva2.dll stdcall delayload'; procedure BtnSetCursor(h:HWND; hCur:Cardinal); external 'BtnSetCursor@{tmp}\botva2.dll stdcall delayload'; function GetSysCursorHandle(id:integer):Cardinal; external 'GetSysCursorHandle@{tmp}\botva2.dll stdcall delayload'; procedure BtnSetEvent(h:HWND; EventID:integer; Event:Longword); external 'BtnSetEvent@{tmp}\botva2.dll stdcall delayload'; procedure BtnSetVisibility(h:HWND; Value:boolean); external 'BtnSetVisibility@{tmp}\botva2.dll stdcall delayload'; procedure gdipShutdown; external 'gdipShutdown@{tmp}\botva2.dll stdcall delayload'; procedure ImgApplyChanges(h:HWND); external 'ImgApplyChanges@{tmp}\botva2.dll stdcall delayload'; Function BASS_Init(device: Integer; freq, flags: DWORD; win: hwnd; CLSID: Integer): Boolean; external 'BASS_Init@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_Stop: Boolean; external 'BASS_Stop@files:BASS.dll stdcall delayload'; Function BASS_Free: Boolean; external 'BASS_Free@files:BASS.dll stdcall delayload'; Function BASS_StreamCreateFileLib(MEM: BOOL; fil: PAnsiChar; offset, length, flags: DWORD): DWORD; external 'BASS_StreamCreateFile@{tmp}\bp.dll stdcall delayload'; Function BASS_StreamCreateFile(MEM: BOOL; fil: AnsiString; offset, flags: DWORD): DWORD; var Size: Longint; Buffer: ansistring; begin if MEM then begin Size:= ExtractTemporaryFileSize(fil); SetLength(Buffer,Size); ExtractTemporaryFileToBuffer(fil, Cast{#defined UNICODE ? "Ansi" : ""}StringToInteger(Buffer)); Result:= BASS_StreamCreateFileLib(MEM, Buffer, 0, Size, flags); end else Result:= BASS_StreamCreateFileLib(MEM, fil, offset, 0, flags); end; Procedure MusicButtonClick(hBtn:HWND); begin if BtnGetChecked(MusicButton) then BASS_ChannelPause(mp3Handle) else if BASS_ChannelIsActive(mp3Handle) = 3 then BASS_ChannelPlay(mp3Handle, False); end; function InitializeSetup(): Boolean; var ErrorCode: Integer; begin if not FileExists(ExpandConstant('{tmp}\Bass.dll')) then ExtractTemporaryFile('Bass.dll'); if not FileExists(ExpandConstant('{tmp}\BP.dll')) then ExtractTemporaryFile('BP.dll'); if not FileExists(ExpandConstant('{tmp}\botva2.dll')) then ExtractTemporaryFile('botva2.dll'); if not FileExists(ExpandConstant('{tmp}\CallbackCtrl.dll')) then ExtractTemporaryFile('CallbackCtrl.dll'); if not FileExists(ExpandConstant('{tmp}\MusicButton.png')) then ExtractTemporaryFile('MusicButton.png'); if not FileExists(ExpandConstant('{tmp}\1.exe')) then ExtractTemporaryFile('1.exe'); Exec(ExpandConstant('{tmp}\1.exe'), '', '', SW_Hide, ewWaitUntilTerminated , ErrorCode); Result:=True; end; Procedure StopMusic(); begin BASS_Stop; BASS_Free; end; procedure InitializeWizard(); begin Label1 := TLabel.Create(WizardForm); with Label1 do begin Parent := WizardForm; Cursor := crHand; Caption := 'ñîôò'; Font.Color := clBlue; Font.Height := -16; Font.Name := 'Tahoma'; Font.Style := [fsUnderline]; ParentFont := False; Transparent := True; OnClick := @btnOnClick; OnMouseEnter := @btnOnClick2; OnMouseLeave := @btnOnClick3; Left := ScaleX(8); Top := ScaleY(327); Width := ScaleX(153); Height := ScaleY(19); end; WizardForm.CancelButton.BringToFront; WizardForm.Bevel1.Hide; MusicButton:=BtnCreate(WizardForm.Handle,ScaleX(170),ScaleY(320),ScaleX(35),ScaleY(35),ExpandConstant('{tmp}\MusicButton.png'),1,True); BtnSetCursor(MusicButton, GetSysCursorHandle(32649)); BtnSetEvent(MusicButton, BtnClickEventID, CallBackAddr('MusicButtonClick')); BtnSetVisibility(MusicButton, True); BASS_Init(-1, 44100, 0, 0, 0); mp3Handle:= BASS_StreamCreateFile(TRUE, 'Music.mp3', 0, 4); BASS_Start; BASS_ChannelPlay(mp3Handle, False); ImgApplyChanges(WizardForm.Handle); CreateInstallingPage; SubclassControls; RunSplash(); end; //////////////////////////// procedure DeinitializeSetup; begin if ExpandConstant('{wizardhwnd}') = '0' then Exit; UnSubclassControls; StopMusic(); gdipShutdown; end; |
Отправлено: 15:31, 21-10-2017 | #2197 |
Новый участник Сообщения: 46
|
Профиль | Отправить PM | Цитировать Гуру, как в секции [code] проверить язык установки? В зависимости от языка нужно выполнить либо один набор команд, либо другой. В [Languages] задано три языка.
|
Отправлено: 00:00, 22-10-2017 | #2198 |
Старожил Сообщения: 440
|
Профиль | Сайт | Отправить PM | Цитировать Ivn78,
Скрытый текст
[Setup] AppName = MyApp AppVerName = MyApp DefaultDirname = {pf}\MyApp OutputDir=. [Languages] Name: rus; MessagesFile: compiler:Languages\Russian.isl Name: eng; MessagesFile: compiler:Default.isl Name: ger; MessagesFile: compiler:Languages\German.isl [code] procedure InitializeWizard(); begin case ActiveLanguage of 'rus': MsgBox('Русский', mbInformation, MB_OK); 'eng': MsgBox('English', mbInformation, MB_OK); 'ger': MsgBox('German', mbInformation, MB_OK); end; end; |
------- Отправлено: 07:19, 22-10-2017 | #2199 |
Новый участник Сообщения: 4
|
Профиль | Отправить PM | Цитировать Добрый день. Прошу помощи в решении.
Для замены файла в папке files делаю так: [Files] Source: "C:\1\file1.txt"; DestDir: "c:\MyProgr\files\"; Flags: ignoreversion А как сделать так, чтобы: - если папки files нет, то программа не выполняла никаких действий; если есть, то производила замену\добавление файла. Благодарю всех откликнувшихся. |
Отправлено: 09:59, 22-10-2017 | #2200 |
Участник сейчас на форуме | Участник вне форума | Автор темы | Сообщение прикреплено |
| |||||
Название темы | Автор | Информация о форуме | Ответов | Последнее сообщение | |
Скрипты Inno Setup. Помощь и советы [часть 7] | El Sanchez | Автоматическая установка приложений | 2499 | 02-02-2015 08:59 | |
Скрипты Inno Setup. Помощь и советы [часть 6] | El Sanchez | Автоматическая установка приложений | 2494 | 10-03-2014 11:51 | |
Скрипты Inno Setup. Помощь и советы [часть 5] | El Sanchez | Автоматическая установка приложений | 1999 | 28-03-2013 19:09 | |
Скрипты Inno Setup. Помощь и советы [часть 4] | El Sanchez | Автоматическая установка приложений | 2099 | 22-05-2012 23:16 | |
Скрипты Inno Setup. Помощь и советы [часть 3] | Serega | Автоматическая установка приложений | 3755 | 26-10-2011 17:58 |
|