|
Внимание, важное сообщение: Дорогие Друзья!
В ноябре далекого 2001 года мы решили создать сайт и форум, которые смогут помочь как начинающим, так и продвинутым пользователям разобраться в операционных системах. В 2004-2006г наш проект был одним из самых крупных ИТ ресурсов в рунете, на пике нас посещало более 300 000 человек в день! Наша документация по службам Windows и автоматической установке помогла огромному количеству пользователей и сисадминов. Мы с уверенностью можем сказать, что внесли большой вклад в развитие ИТ сообщества рунета. Но... время меняются, приоритеты тоже. И, к сожалению, пришло время сказать До встречи! После долгих дискуссий было принято решение закрыть наш проект. 1 августа форум переводится в режим Только чтение, а в начале сентября мы переведем рубильник в положение Выключен Огромное спасибо за эти 24 года, это было незабываемое приключение. Сказать спасибо и поделиться своей историей можно в данной теме. С уважением, ваш призрачный админ, BigMac... |
|
| Компьютерный форум OSzone.net » Автоматическая установка Windows » Автоматическая установка приложений » Скрипты Inno Setup. Помощь и советы [часть 9] |
|
|
Скрипты Inno Setup. Помощь и советы [часть 9]
|
|
Ветеран Сообщения: 1274 |
Внимание! Данная тема предназначена только для обсуждения написания скриптов!
Остальные вопросы, а также последние версии компилятора в теме Inno Setup. Прочие вопросы. Показать/скрыть: Справка, руководство, примеры:
Показать/скрыть: Ссылки на примеры скриптов:
Показать/скрыть: Дополнительные программы для Inno Setup:
Предыдущие ветки обсуждения по ссылкам ниже и в прикреплённых архивах: Скрипты Inno Setup. Помощь и советы [часть 6] | Скрипты Inno Setup. Помощь и советы [часть 6].7z Скрипты Inno Setup. Помощь и советы [часть 7] | Скрипты Inno Setup. Помощь и советы [часть 7].7z Скрипты Inno Setup. Помощь и советы [часть 8] | Скрипты Inno Setup. Помощь и советы [часть 8].7z |
|
|
Отправлено: 16:09, 04-04-2018 |
|
Пользователь Сообщения: 50
|
Профиль | Отправить PM | Цитировать Секция code
пусто
|
|
Последний раз редактировалось TheLeon, 08-04-2018 в 12:07. Отправлено: 21:26, 07-04-2018 | #11 |
|
Ветеран Сообщения: 862
|
Профиль | Отправить PM | Цитировать TheLeon, дайте мне полный скрипт вместе с картинками
|
|
------- Отправлено: 21:54, 07-04-2018 | #12 |
|
Ветеран Сообщения: 862
|
Профиль | Отправить PM | Цитировать Цитата TheLeon:
[Setup]
AppName=Моя программа
AppVersion=1.5
AppPublisher=YURSHAT
AppPublisherURL=http://krinkels.org/
DefaultDirName={pf}\Моя программа
[Languages]
Name: "RU"; MessagesFile: "compiler:Languages\Russian.isl"
[CustomMessages]
RU.CompName1=Компонент 1
RU.CompName2=Компонент 2
RU.ComponentsInfo=Наведите курсор мыши на компонент, чтобы прочитать его описание.
RU.ComponentsImgInfo=Наведите курсор мыши на компонент, чтобы посмотреть его превью.
RU.CompDesc1=Описание первого компонента
RU.CompDesc2=Описание второго компонента
[Files]
Source: "compiler:WizModernImage.bmp"; DestName: "CompDescImg1.bmp"; Flags: dontcopy
Source: "compiler:WizModernImage-IS.bmp"; DestName: "CompDescImg2.bmp"; Flags: dontcopy
[Types]
Name: full; Description: Full installation; Flags: iscustom
[Components]
Name: comp1; Description: "{cm:CompName1}"; Types: full
Name: comp2; Description: "{cm:CompName2}"; Types: full
[Code]
type
TComponentDesc = record
Description: String;
ImageName: String;
Index: Integer;
end;
var
CompDescs: array of TComponentDesc;
CompDescPanel, CompDescImgPanel: TPanel;
CompDescText: array[1..2] of TLabel;
CompIndex, LastIndex: Integer;
CompDescImg: TBitmapImage;
procedure ShowCompDescription(Sender: TObject; X, Y, Index: Integer; Area: TItemArea);
var
i: Integer;
begin
if Index = LastIndex then Exit;
CompIndex := -1;
for i := 0 to GetArrayLength(CompDescs) -1 do
begin
if (CompDescs[i].Index = Index) then
begin
CompIndex := i;
Break;
end;
end;
if (CompIndex >= 0) and (Area = iaItem) then
begin
if not FileExists(ExpandConstant('{tmp}\') + CompDescs[CompIndex].ImageName) then
ExtractTemporaryFile(CompDescs[CompIndex].ImageName);
CompDescImg.Bitmap.LoadFromFile(ExpandConstant('{tmp}\') + CompDescs[CompIndex].ImageName);
CompDescImg.Show;
CompDescText[2].Caption := CompDescs[CompIndex].Description;
CompDescText[2].Enabled := True;
end else
begin
CompDescText[2].Caption := CustomMessage('ComponentsInfo');
CompDescText[2].Enabled := False;
CompDescImg.Hide;
end;
LastIndex := Index;
end;
procedure CompListMouseLeave(Sender: TObject);
begin
CompDescImg.Hide;
CompDescText[2].Caption := CustomMessage('ComponentsInfo');
CompDescText[2].Enabled := False;
LastIndex := -1;
end;
procedure AddCompDescription(AIndex: Integer; ADescription: String; AImageName: String);
var
i: Integer;
begin
i := GetArrayLength(CompDescs);
SetArrayLength(CompDescs, i + 1);
CompDescs[i].Description := ADescription;
CompDescs[i].ImageName := AImageName;
CompDescs[i].Index := AIndex - 1
end;
procedure InitializeWizard();
begin
WizardForm.SelectComponentsLabel.Hide;
WizardForm.TypesCombo.Hide;
WizardForm.ComponentsList.SetBounds(ScaleX(0), ScaleY(0), ScaleX(184), ScaleY(205));
WizardForm.ComponentsList.OnItemMouseMove:= @ShowCompDescription;
WizardForm.ComponentsList.OnMouseLeave := @CompListMouseLeave;
CompDescImgPanel := TPanel.Create(WizardForm);
with CompDescImgPanel do
begin
Parent := WizardForm.SelectComponentsPage;
SetBounds(ScaleX(192), ScaleY(0), ScaleX(225), ScaleY(120));
BevelInner := bvLowered;
end;
CompDescText[1] := TLabel.Create(WizardForm);
with CompDescText[1] do
begin
Parent := CompDescImgPanel;
SetBounds(ScaleX(5), ScaleY(5), CompDescImgPanel.Width - ScaleX(10), CompDescImgPanel.Height - ScaleY(10));
AutoSize := False;
WordWrap := True;
Enabled := False;
Caption := CustomMessage('ComponentsImgInfo');
end;
CompDescImg := TBitmapImage.Create(WizardForm);
with CompDescImg do
begin
Parent := CompDescImgPanel;
SetBounds(ScaleX(5), ScaleY(5), CompDescImgPanel.Width - ScaleX(10), CompDescImgPanel.Height - ScaleY(10));
Stretch := True;
Hide;
end;
CompDescPanel := TPanel.Create(WizardForm);
with CompDescPanel do
begin
Parent := WizardForm.SelectComponentsPage;
SetBounds(ScaleX(192), ScaleY(125), ScaleX(225), ScaleY(80));
BevelInner := bvLowered;
end;
CompDescText[2] := TLabel.Create(WizardForm);
with CompDescText[2] do
begin
Parent := CompDescPanel;
SetBounds(ScaleX(5), ScaleY(5), CompDescPanel.Width - ScaleX(10), CompDescPanel.Height - ScaleY(10));
AutoSize := False;
WordWrap := True;
Enabled := False;
Caption := CustomMessage('ComponentsInfo');
end;
AddCompDescription(1, CustomMessage('CompDesc1'), 'CompDescImg1.bmp');
AddCompDescription(2, CustomMessage('CompDesc2'), 'CompDescImg2.bmp');
end;
|
|
|
------- Отправлено: 00:08, 08-04-2018 | #13 |
|
Пользователь Сообщения: 50
|
Профиль | Отправить PM | Цитировать Секция CODE
пусто
|
|
Последний раз редактировалось TheLeon, 08-04-2018 в 15:31. Отправлено: 12:04, 08-04-2018 | #14 |
|
Ветеран Сообщения: 862
|
Профиль | Отправить PM | Цитировать Цитата TheLeon:
var
Label1: TLabel;
procedure Label1Click(Sender: TObject);
var ErrorCode: Integer;
begin
ShellExec('open','http://www.innosetup.com','', '', SW_SHOW, ewNoWait, ErrorCode)
end;
procedure InitializeWizard();
begin
Label1 := TLabel.Create(WizardForm);
with Label1 do
begin
Parent := WizardForm;
Caption := 'Developed by Leon and OSzone.net';
SetBounds(ScaleX(15),ScaleY(338),ScaleX(132),ScaleY(130));
Font.Size := 7;
OnClick:=@Label1Click;
Font.Color:=clBlue;
Enabled:=True;
Cursor:=crHand;
end;
end;
Цитата TheLeon:
var
Image1: TBitmapImage;
procedure Image1Click(Sender: TObject);
var ErrorCode: Integer;
begin
ShellExec('open','http://www.innosetup.com','', '', SW_SHOW, ewNoWait, ErrorCode)
end;
procedure InitializeWizard();
begin
Image1 := TBitmapImage.Create(WizardForm);
with Image1 do
begin
Parent := WizardForm.SelectDirPage;
SetBounds(ScaleX(0),ScaleY(70),ScaleX(416),ScaleY(170));
ExtractTemporaryFile('BMP.bmp');
Bitmap.LoadFromFile(ExpandConstant('{tmp}\BMP.bmp'));
OnClick:=@Image1Click;
Enabled:=True;
Cursor:=crHand;
end;
end;
|
||
|
------- Последний раз редактировалось habib2302, 09-04-2018 в 11:45. Отправлено: 14:17, 08-04-2018 | #15 |
|
Ветеран Сообщения: 1274
|
Профиль | Отправить PM | Цитировать Цитата ABBAT:
Скрытый текст
[Setup]
AppName=test
AppVerName=test
CreateAppDir=no
DefaultDirName={tmp}
Uninstallable=no
CreateUninstallRegKey=no
[Languages]
Name: ru; MessagesFile: compiler:Languages\russian.isl
[Code]
#define A = (Defined UNICODE) ? "W" : "A"
const
GENERIC_READ = $80000000;
GENERIC_WRITE = $40000000;
FILE_SHARE_READ = $1;
FILE_SHARE_WRITE = $2;
OPEN_EXISTING = 3;
INVALID_HANDLE_VALUE = -1;
IOCTL_ATA_PASS_THROUGH = $0004D02C;
ATA_FLAGS_DRDY_REQUIRED = $0001;
ATA_FLAGS_DATA_IN = $0002;
ID_CMD = $EC;
type
TATAPassThroughEx = record
Length: WORD;
AtaFlags: WORD;
PathId: Byte;
TargetId: Byte;
Lun: Byte;
ReservedAsUchar: Byte;
DataTransferLength: DWORD;
TimeOutValue: DWORD;
ReservedAsUlong: DWORD;
DataBufferOffset: DWORD;
PreviousTaskFile: array [0..7] of Byte;
CurrentTaskFile: array [0..7] of Byte;
end;
TATAIdentifyDeviceQuery = record
Header: TATAPassThroughEx;
Data: array [0..255] of WORD;
end;
// Device Management Functions
function DeviceIoControlATAIdentifyDeviceQuery(hDevice: THandle; dwIoControlCode: DWORD; var lpInBuffer: TATAIdentifyDeviceQuery; nInBufferSize: DWORD; out lpOutBuffer: TATAIdentifyDeviceQuery; nOutBufferSize: DWORD; out lpBytesReturned: DWORD; lpOverlapped: DWORD): BOOL; external 'DeviceIoControl@kernel32.dll stdcall';
// File Management Functions
function CreateFile(lpFileName: string; dwDesiredAccess, dwShareMode: DWORD; lpSecurityAttributes: Longint; dwCreationDisposition, dwFlagsAndAttributes: DWORD; hTemplateFile: THandle): THandle; external 'CreateFile{#A}@kernel32.dll stdcall';
// Handle and Object Functions
function CloseHandle(hObject: THandle): BOOL; external 'CloseHandle@kernel32.dll stdcall';
/////////////////////////////////////////////////////////
function IsDriveSSD(const ADriveLetter: string): Boolean;
var
BytesReturned: DWORD;
DeviceHandle: THandle;
ATAIdentifyDeviceQuery: TATAIdentifyDeviceQuery;
begin
Result := False;
try
DeviceHandle := CreateFile(Format('\\.\%s', [ADriveLetter]), GENERIC_READ or GENERIC_WRITE, FILE_SHARE_READ or FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if DeviceHandle = INVALID_HANDLE_VALUE then
RaiseException(SysErrorMessage(DLLGetLastError));
ATAIdentifyDeviceQuery.Header.Length := SizeOf(ATAIdentifyDeviceQuery.Header);
ATAIdentifyDeviceQuery.Header.AtaFlags := ATA_FLAGS_DATA_IN or ATA_FLAGS_DRDY_REQUIRED;
ATAIdentifyDeviceQuery.Header.DataTransferLength := SizeOf(ATAIdentifyDeviceQuery.Data);
ATAIdentifyDeviceQuery.Header.TimeOutValue := 3;
ATAIdentifyDeviceQuery.Header.DataBufferOffset := SizeOf(ATAIdentifyDeviceQuery.Header);
ATAIdentifyDeviceQuery.Header.CurrentTaskFile[6{ = Command/Status register }] := ID_CMD; // ATA IDENTIFY DEVICE command
if not DeviceIoControlATAIdentifyDeviceQuery(DeviceHandle, IOCTL_ATA_PASS_THROUGH, ATAIdentifyDeviceQuery, SizeOf(ATAIdentifyDeviceQuery), ATAIdentifyDeviceQuery, SizeOf(ATAIdentifyDeviceQuery), BytesReturned, 0) then
begin
Log(Format('DeviceIoControl failed: %s', [SysErrorMessage(DLLGetLastError)]));
Exit;
end;
Result := ATAIdentifyDeviceQuery.Data[{ Word }217{: Nominal media rotation rate }] = 1;
finally
if DeviceHandle > 0 then
CloseHandle(DeviceHandle);
end;
end;
///////////////////////////
procedure InitializeWizard;
begin
if IsDriveSSD(ExpandConstant('{sd}')) then
MsgBox('SSD', mbInformation, MB_OK)
else
MsgBox('No SSD', mbInformation, MB_OK);
end;
|
|
|
Отправлено: 15:28, 08-04-2018 | #16 |
|
Новый участник Сообщения: 23
|
Профиль | Отправить PM | Цитировать El Sanchez,
Цитата:
|
|
|
Отправлено: 21:58, 08-04-2018 | #17 |
|
Пользователь Сообщения: 50
|
Профиль | Отправить PM | Цитировать El Sanchez, здравствуйте, сможете ли помочь с задуманным?
.ISS
пусто
|
|
Последний раз редактировалось TheLeon, 11-04-2018 в 19:10. Отправлено: 19:09, 10-04-2018 | #18 |
|
Ветеран Сообщения: 1274
|
Профиль | Отправить PM | Цитировать Цитата TheLeon:
Скрытый текст
[Setup]
AppName=test
AppVerName=test
DefaultDirName={tmp}
Uninstallable=no
CreateUninstallRegKey=no
LicenseFile=compiler:license.txt
[Languages]
Name: ru; MessagesFile: compiler:Languages\russian.isl
[Messages]
ru.WizardLicense=Сканирование...
[Code]
//////////////////////////
procedure ChangeMainPanel;
var
HelpBitmap: TBitmapImage;
begin
WizardForm.PageDescriptionLabel.Hide;
with WizardForm.WizardSmallBitmapImage do
begin
Left := ScaleX(10);
Top := (Parent.Height - Height) div 2;
end;
HelpBitmap := TBitmapImage.Create(WizardForm.MainPanel);
with HelpBitmap do
begin
Parent := WizardForm.MainPanel;
Bitmap.LoadFromFile('{#CompilerPath }\WizModernSmallImage-IS.bmp');
AutoSize := True;
Left := Parent.Width - Width - ScaleX(10);
Top := (Parent.Height - Height) div 2;
ShowHint := True;
Hint := 'Sample text';
end;
with WizardForm.PageNameLabel do
begin
Font.Color := clGray;
Font.Size := 14;
Font.Style := [];
AdjustHeight;
Left := WizardForm.WizardSmallBitmapImage.Left + WizardForm.WizardSmallBitmapImage.Width + ScaleX(10);
Top := (Parent.Height - Height) div 2;
Width := HelpBitmap.Left - Left - ScaleX(10);
end;
end;
///////////////////////////
procedure InitializeWizard;
begin
ChangeMainPanel;
end;
Цитата TheLeon:
Скрытый текст
[Setup]
AppName=test
AppVerName=test
DefaultDirName={tmp}
Uninstallable=no
CreateUninstallRegKey=no
[Languages]
Name: ru; MessagesFile: compiler:Languages\russian.isl
[Code]
#define A = (Defined UNICODE) ? "W" : "A"
const
WS_CHILD = $40000000;
WS_VISIBLE = $10000000;
WS_DISABLED = $08000000;
// ATL Functions
function AtlAxWinInit: BOOL; external 'AtlAxWinInit@atl.dll stdcall';
function AtlAxCreateControl(lpszName: string; hWnd: HWND; pStream, ppUnkContainer: Longint): HResult; external 'AtlAxCreateControl@atl.dll stdcall';
// Window Functions
function GetSysColor(nIndex: Integer): DWORD; external 'GetSysColor@user32.dll stdcall';
function CreateWindowEx(dwExStyle: DWORD; lpClassName, lpWindowName: string; dwStyle: DWORD; x, y, nWidth, nHeight: Integer; hWndParent: HWND; hMenu: HMENU; hInstance, lpParam: Longint): HWND; external 'CreateWindowEx{#A}@user32.dll stdcall';
function DestroyWindow(hWnd: HWND): BOOL; external 'DestroyWindow@user32.dll stdcall';
var
GIFWndHandle: HWND;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ShowAnimatedGIF(AWndParent: HWND; ALeft, ATop, AWidth, AHeight: Integer; AUrl: string; AColor: TColor): HWND;
(*
Parameters:
AWndParent...: A handle to the parent window
ALeft........: The initial horizontal position of the window
ATop.........: The initial vertical position of the window
AWidth.......: The width of the window
AHeight......: The height of the window
AUrl.........: The URL or full path of the GIF file
AColor.......: Color background
Return value:
A handle to ActiveX control host window
*)
var
HTMLStr: string;
ResultCode: HResult;
begin
if not AtlAxWinInit then Exit;
Result := CreateWindowEx(0, 'AtlAxWin', '', WS_CHILD or WS_VISIBLE or WS_DISABLED, ALeft, ATop, AWidth, AHeight, AWndParent, 0, 0, 0);
if Result = 0 then
RaiseException(SysErrorMessage(DLLGetLastError));
if AColor < 0 then
AColor := GetSysColor(AColor and $0000FF);
HTMLStr := Format('about:<html><body leftmargin="0" topmargin="0" scroll="no" bgcolor="#%.2x%.2x%.2x"><p align="center"><img src="%s" height="100%%"></img></p></body></html>', [AColor and $0000FF, AColor and $00FF00 shr 8, AColor and $FF0000 shr 16, AUrl]);
ResultCode := AtlAxCreateControl(HTMLStr, Result, 0, 0);
if ResultCode <> 0 then
RaiseException(SysErrorMessage(ResultCode));
end;
///////////////////////////
procedure InitializeWizard;
begin
GIFWndHandle := ShowAnimatedGIF(WizardForm.SelectDirPage.Handle,
0, WizardForm.DirEdit.Top + WizardForm.DirEdit.Height + ScaleY(5), WizardForm.SelectDirPage.Width, WizardForm.DiskSpaceLabel.Top - WizardForm.DirEdit.Top - WizardForm.DirEdit.Height - ScaleY(5),
'https://media.giphy.com/media/9y0qXExCElAgU/giphy.gif', WizardForm.SelectDirPage.Color);
end;
////////////////////////////
procedure DeinitializeSetup;
begin
if GIFWndHandle <> 0 then
DestroyWindow(GIFWndHandle);
end;
Цитата TheLeon:
Скрытый текст
Цитата TheLeon:
|
||||
|
Отправлено: 18:12, 11-04-2018 | #19 |
|
Пользователь Сообщения: 77
|
Профиль | Отправить PM | Цитировать Здраствуйте, ув. форумчане. Подскажите пож. Возникла следующая проблема:
1. Создана кастомная страница var Page: TWizardPage; procedure InitializeWizard(); begin Page := CreateCustomPage(wpWelcome, 'ISCustomPage1_Caption', 'ISCustomPage1_Description'); end; Со стандартными страницами всё ясно на как быть в таком случае ? |
|
Отправлено: 21:14, 24-04-2018 | #20 |
|
|
Участник сейчас на форуме |
|
Участник вне форума |
![]() |
Автор темы |
![]() |
Сообщение прикреплено |
| |||||
| Название темы | Автор | Информация о форуме | Ответов | Последнее сообщение | |
| Скрипты 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 | |
|