Войти

Показать полную графическую версию : [архив] Скрипты Inno Setup. Помощь и советы [часть 2]


Страниц : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 [41] 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133

Tukash
03-01-2010, 15:23
JohnDes,
Вот скрипты, пробуй!

[_Code]
const
Archives = '{src}\*.cab'; // укажите расположение архивов FreeArc; для внешних файлов строку в [Files] добавлять необязательно

PM_REMOVE = 1;
CP_ACP = 0; CP_UTF8 = 65001;
oneMb = 1048576;

type
#ifdef UNICODE ; если у вас ошибка на этой строке, то установите препроцессор или исправьте скрипт для вашей версии Inno Setup
#define A "W"
#else
#define A "A" ; точка входа в SetWindowText, {#A} меняется на A или W в зависимости от версии
PAnsiChar = PChar; // Required for Inno Setup 5.3.0 and higher. (требуется для 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

TMyMsg = record
hwnd: HWND;
message: UINT;
wParam: Longint;
lParam: Longint;
time: DWORD;
pt: TPoint;
end;

TFreeArcCallback = function (what: PAnsiChar; int1, int2: Integer; str: PAnsiChar): Integer;
TArc = record Path: string; OrigSize: Integer; Size: Extended; end;

var
ExtractFile: TLabel;
lblExtractFileName: TLabel;
btnCancelUnpacking: TButton;
CancelCode, n, UnPackError, StartInstall: Integer;
Arcs: array of TArc;
msgError: string;
lastMb: Integer;
baseMb: Integer;
totalUncompressedSize: Integer; // total uncompressed size of archive data in mb
LastTimerEvent: DWORD;

Function MultiByteToWideChar(CodePage: UINT; dwFlags: DWORD; lpMultiByteStr: string; cbMultiByte: integer; lpWideCharStr: string; cchWideChar: integer): longint; external 'MultiByteToWideChar@kernel32.dll stdcall';
Function WideCharToMultiByte(CodePage: UINT; dwFlags: DWORD; lpWideCharStr: string; cchWideChar: integer; lpMultiByteStr: string; cbMultiByte: integer; lpDefaultChar: integer; lpUsedDefaultChar: integer): longint; external 'WideCharToMultiByte@kernel32.dll stdcall';

function PeekMessage(var lpMsg: TMyMsg; hWnd: HWND; wMsgFilterMin, wMsgFilterMax, wRemoveMsg: UINT): BOOL; external 'PeekMessageA@user32.dll stdcall';
function TranslateMessage(const lpMsg: TMyMsg): BOOL; external 'TranslateMessage@user32.dll stdcall';
function DispatchMessage(const lpMsg: TMyMsg): Longint; external 'DispatchMessageA@user32.dll stdcall';

Function OemToChar(lpszSrc, lpszDst: AnsiString): longint; external 'OemToCharA@user32.dll stdcall';
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 GetTickCount: DWord; external 'GetTickCount@kernel32';
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';

procedure AppProcessMessage;
var
Msg: TMyMsg;
begin
while PeekMessage(Msg, 0, 0, 0, PM_REMOVE) do begin
TranslateMessage(Msg);
DispatchMessage(Msg);
end;
end;

// Перевод числа в строку с точностью 3 знака (%.3n) с округлением дробной части, если она есть
Function NumToStr(Float: Extended): String;
Begin
Result:= Format('%.3n', [Float]); StringChange(Result, ',', '.');
while ((Result[Length(Result)] = '0') or (Result[Length(Result)] = '.')) and (Length(Result) > 1) do
SetLength(Result, Length(Result)-1);
End;

function cm(Message: String): String; Begin Result:= ExpandConstant('{cm:'+ Message +'}') 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;

// 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 : integer;
WideCharBuf: string;
MultiByteBuf: string;
begin
strSource:= strSource + chr(0);
SetLength( WideCharBuf, Length( strSource ) * 2 );
SetLength( MultiByteBuf, Length( strSource ) * 2 );

nRet:= MultiByteToWideChar( CP_ACP, 0, strSource, -1, WideCharBuf, Length(WideCharBuf) );
nRet:= WideCharToMultiByte( CP_UTF8, 0, WideCharBuf, -1, MultiByteBuf, Length(MultiByteBuf), 0, 0);

Result:= MultiByteBuf;
end;

// OnClick event function for btnCancel
procedure btnCancelUnpackingOnClick(Sender: TObject);
begin
if MsgBox( SetupMessage( msgExitSetupMessage ), mbInformation, MB_YESNO ) = IDYES then
CancelCode:= -127;
end;

var origsize: Integer;
// The callback function for getting info about FreeArc archive
function FreeArcInfoCallback (what: PAnsiChar; Mb, sizeArc: Integer; str: PAnsiChar): Integer;
begin
if string(what)='origsize' then origsize := Mb else
if string(what)='compsize' then else
if string(what)='total_files' then else
Result:= CancelCode;
end;

// Returns decompressed size of files in archive
function ArchiveOrigSize(arcname: string): Integer;
var
callback: longword;
Begin
callback:= WrapFreeArcCallback(@FreeArcInfoCallback,4); //FreeArcInfoCallback has 4 arguments
CancelCode:= 0;
AppProcessMessage;
try
// Pass the specified arguments to 'unarc.dll'
Result:= FreeArcExtract (callback, 'l', '--', AnsiToUtf8(arcname), '', '', '', '', '', '', '');
if CancelCode < 0 then Result:= CancelCode;
if Result >= 0 then Result:= origsize;
except
Result:= -63; // ArcFail
end;
end;

// Scans the specified folders for archives and add them to list
function FindArcs(dir: string): Extended;
var
FSR: TFindRec;
Begin
Result:= 0;
if FindFirst(ExpandConstant(dir), FSR) then begin
try
repeat
// Skip everything but the folders
if FSR.Attributes and FILE_ATTRIBUTE_DIRECTORY > 0 then CONTINUE;
n:= GetArrayLength(Arcs);
// Expand the folder list
SetArrayLength(Arcs, n +1);
Arcs[n].Path:= ExtractFilePath(ExpandConstant(dir)) + FSR.Name;
Arcs[n].Size:= Size64(FSR.SizeHigh, FSR.SizeLow);
Result:= Result + Arcs[n].Size;
Arcs[n].OrigSize := ArchiveOrigSize(Arcs[n].Path)
totalUncompressedSize := totalUncompressedSize + Arcs[n].OrigSize
until not FindNext(FSR);
finally
FindClose(FSR);
end;
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;

// Converts milliseconds to human-readable time
// Конвертирует милисекунды в человеко-читаемое изображение времени
Function TicksToTime(Ticks: DWord; h,m,s: String; detail: Boolean): String;
Begin
if detail {hh:mm:ss format} then
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 {more than hour} then
Result:= IntToStr(Ticks/3600000) +h+' '+ PADZ(IntToStr((Ticks/1000 - Ticks/1000/3600*3600)/60), 2) +m
else if Ticks/60 >= 1000 {1..60 minutes} then
Result:= IntToStr(Ticks/60000) +m+' '+ PADZ(IntToStr(Ticks/1000 - Ticks/1000/60*60), 2) +s
else Result:= IntToStr(Ticks/1000) +s {less than one minute}
End;

// The main callback function for unpacking FreeArc archives
function FreeArcCallback (what: PAnsiChar; Mb, sizeArc: Integer; str: PAnsiChar): Integer;
var
percents, Remaining: Integer;
s: String;
begin
if GetTickCount - LastTimerEvent > 1000 then begin
// This code will be executed once each 1000 ms (этот код будет выполняться раз в 1000 миллисекунд)
// ....
// End of code executed by timer
LastTimerEvent := LastTimerEvent+1000;
end;

if string(what)='filename' then begin
// Update FileName label
lblExtractFileName.Caption:= FmtMessage( cm( 'Extracting' ), [OemToAnsiStr( str )] )
end else if (string(what)='write') and (totalUncompressedSize>0) and (Mb>lastMb) then begin
// Assign to Mb *total* amount of data extracted to the moment from all archives
lastMb := Mb;
Mb := baseMb+Mb;

// Update progress bar
WizardForm.ProgressGauge.Position:= Mb;

// Show how much megabytes/archives were processed up to the moment
percents:= (Mb*1000) div totalUncompressedSize;
s := FmtMessage(cm('ExtractedInfo'), [IntToStr(Mb), IntToStr(totalUncompressedSize)]);
if GetArrayLength(Arcs)>1 then
s := s + '. '+FmtMessage(cm('ArcInfo'), [IntToStr(n+1), IntToStr(GetArrayLength(Arcs))])
ExtractFile.Caption := s

// Calculate and show current percents
percents:= (Mb*1000) div totalUncompressedSize;
s:= FmtMessage(cm('AllProgress'), [Format('%.1n', [Abs(percents/10)])]);
if Mb > 0 then Remaining:= trunc((GetTickCount - StartInstall) * Abs((totalUncompressedSize - Mb)/Mb)) else Remaining:= 0;
if Remaining = 0 then SetTaskBarTitle(cm('ending')) else begin
s:= s + '. '+FmtMessage(cm('remains'), [TicksToTime(Remaining, cm('hour'), cm('min'), cm('sec'), false)])
SetTaskBarTitle(FmtMessage(cm('taskbar'), [IntToStr(percents/10), TicksToTime(Remaining, 'h', 'm', 's', false)]))
end;
WizardForm.FileNameLabel.Caption := s
end;
AppProcessMessage;
Result:= CancelCode;
end;

// Extracts all found archives
function UnPack(Archives: string): Integer;
var
totalCompressedSize: Extended;
callback: longword;
FreeMB, TotalMB: Cardinal;
begin
// Display 'Extracting FreeArc archive'
lblExtractFileName.Caption:= '';
lblExtractFileName.Show;
ExtractFile.caption:= cm('ArcTitle');
ExtractFile.Show;
// Show the 'Cancel unpacking' button and set it as default button
btnCancelUnpacking.Caption:= WizardForm.CancelButton.Caption;
btnCancelUnpacking.Show;
WizardForm.ActiveControl:= btnCancelUnpacking;
WizardForm.ProgressGauge.Position:= 0;
// Get the size of all archives
totalUncompressedSize := 0;
totalCompressedSize := FindArcs(Archives);
WizardForm.ProgressGauge.Max:= totalUncompressedSize;
// Other initializations
callback:= WrapFreeArcCallback(@FreeArcCallback,4); //FreeArcCallback has 4 arguments
StartInstall:= GetTickCount; {время начала распаковки}
LastTimerEvent:= GetTickCount;
baseMb:= 0

for n:= 0 to GetArrayLength(Arcs) -1 do
begin
lastMb := 0
CancelCode:= 0;
AppProcessMessage;
try
// Pass the specified arguments to 'unarc.dll'
Result:= FreeArcExtract (callback, 'x', '-o+', '-dp' + AnsiToUtf8( ExpandConstant('{app}') ), '--', AnsiToUtf8(Arcs[n].Path), '', '', '', '', '');
if CancelCode < 0 then Result:= CancelCode;
except
Result:= -63; // ArcFail
end;
baseMb:= baseMb+lastMb

// Error occured
if Result <> 0 then
begin
msgError:= FmtMessage(cm('ArcError'), [IntToStr(Result)]);
GetSpaceOnDisk(ExtractFileDrive(ExpandConstant('{app}')), True, FreeMB, TotalMB);
case Result of
-1: if FreeMB < 32 {Мб на диске} then msgError:= SetupMessage(msgDiskSpaceWarningTitle)
else msgError:= msgError + #13#10 + FmtMessage(cm('ArcBroken'), [ExtractFileName(Arcs[n].Path)]);
-127: msgError:= cm('ArcBreak'); //Cancel button
-63: msgError:= cm('ArcFail');
end;
// MsgBox(msgError, mbInformation, MB_OK); //сообщение показывается на странице завершения
Log(msgError);
Break; //прервать цикл распаковки
end;
end;
// Hide labels and button
WizardForm.FileNameLabel.Caption:= '';
lblExtractFileName.Hide;
ExtractFile.Hide;
btnCancelUnpacking.Hide;
end;

procedure CurStepChanged1(CurStep: TSetupStep);
begin
if CurStep = ssPostInstall then
begin
UnPackError:= UnPack(Archives)
if UnPackError = 0 then
SetTaskBarTitle(SetupMessage(msgSetupAppTitle))
else
begin
// Error occured, uninstall it then
Exec(ExpandConstant('{uninstallexe}'), '/SILENT','', sw_Hide, ewWaitUntilTerminated, n); //откат установки из-за ошибки unarc.dll
SetTaskBarTitle(SetupMessage(msgErrorTitle))
WizardForm.Caption:= SetupMessage(msgErrorTitle) +' - '+ cm('ArcBreak')
end;
end;
end;

// стандартный способ отката (не нужна CurPageChanged1), но архивы распаковываются до извлечения файлов инсталлятора
// if CurStep = ssInstall then
// if UnPack(Archives) <> 0 then Abort;

Procedure CurPageChanged1(CurPageID: Integer);
Begin
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 InitializeWizard1();
begin
with WizardForm.ProgressGauge do
begin
// Create a label to show current FileName being extracted
lblExtractFileName:= TLabel.Create(WizardForm);
lblExtractFileName.parent:=WizardForm.InstallingPage;
lblExtractFileName.autosize:=false;
lblExtractFileName.Width:= Width;
lblExtractFileName.top:=Top + ScaleY(35);
lblExtractFileName.Caption:= '';
lblExtractFileName.Hide;

// Create a label to show percentage
ExtractFile:= TLabel.Create(WizardForm);
ExtractFile.parent:=WizardForm.InstallingPage;
ExtractFile.autosize:=false;
ExtractFile.Width:= Width;
ExtractFile.top:=lblExtractFileName.Top + ScaleY(16);
ExtractFile.caption:= '';
ExtractFile.Hide;
end;

// Create a 'Cancel unpacking' button and hide it for now.
btnCancelUnpacking:=TButton.create(WizardForm);
btnCancelUnpacking.Parent:= WizardForm;
btnCancelUnpacking.SetBounds(WizardForm.CancelButton.Left, WizardForm.CancelButton.top, WizardForm.CancelButton.Width, WizardForm.CancelButton.Height);
btnCancelUnpacking.OnClick:= @btnCancelUnpackingOnClick;
btnCancelUnpacking.Hide;
end;

procedure InitializeWizard2();
begin
//Выносим кнопку "Отмена" на передний план
WizardForm.CancelButton.BringToFront;
end;

procedure CurPageChanged2(CurPageID: Integer);
begin
if CurPageID=wpInstalling
then
begin
WizardForm.MainPanel.Visible:=False;
WizardForm.Bevel1.Visible:=False;
WizardForm.Width:=ScaleX(395);
WizardForm.Height:=ScaleY(142);
//Здесь смещение страницы установки (в верхний левый угол)
WizardForm.Left:=ScaleX(0);
WizardForm.Top:=ScaleY(0);
{Внимание! Нижеописанные способы смещения работают только когда вставлено фоновое изображение или WindowVisible=yes}
{Выводит в правом верхнем углу экрана}
//WizardForm.Left:=ScaleX(MainForm.Width-420);
//WizardForm.Top:=ScaleY(MainForm.Left+20);

{Выводит снизу по центру экрана}
//WizardForm.Position:=poScreenCenter;
//WizardForm.Top:=ScaleY(MainForm.Height-170);

{Выводит в нижнем левом углу (как в Doom 3 Resurrection of Evil от 1C)}
//WizardForm.Left:=ScaleX(MainForm.Left+20);
//WizardForm.Top:=ScaleY(MainForm.Height-170);

{Выводит в нижнем правом углу}
//WizardForm.Left:=ScaleX(MainForm.Width-420);
//WizardForm.Top:=ScaleY(MainForm.Height-170);

WizardForm.InnerNotebook.Left:=ScaleX(10);
WizardForm.InnerNotebook.Top:=ScaleY(10);
WizardForm.InnerNotebook.Width:=ScaleX(370);
WizardForm.StatusLabel.Left:=ScaleX(0);
WizardForm.StatusLabel.Top:=ScaleY(0);
WizardForm.StatusLabel.Width:=WizardForm.InnerNotebook.Width;
WizardForm.FileNameLabel.Left:=ScaleX(0);
WizardForm.FileNameLabel.Top:=ScaleY(20);
WizardForm.FileNameLabel.Width:=WizardForm.InnerNotebook.Width;
WizardForm.ProgressGauge.Top:=ScaleY(40);
WizardForm.ProgressGauge.Width:=WizardForm.InnerNotebook.Width;
WizardForm.CancelButton.Left:=ScaleX(154);
WizardForm.CancelButton.Top:=ScaleY(80);
end
if CurPageID=wpFinished
then
begin
WizardForm.Width:=502;{Размер окна по горизонтали}
WizardForm.Height:=392;{Размер окна по вертикали}
WizardForm.Position:=poScreenCenter; {Возврат в исходное состояние}
end
end;


procedure CurStepChanged(CurStep: TSetupStep);
begin
CurStepChanged1(CurStep);
end;

procedure CurPageChanged(CurPageID: Integer);
begin
CurPageChanged1(CurPageID);
CurPageChanged2(CurPageID);
end;

procedure InitializeWizard();
begin
InitializeWizard1();
InitializeWizard2();
end;

JohnDes
03-01-2010, 15:50
JohnDes,
Вот скрипты, пробуй! »
Ну я и сам склеивал, в посте было написано
Чтобы не было вот так и работала кнопка отмены
В конечном итоге как и было http://s19.radikal.ru/i192/1001/ca/8f679f61ec2dt.jpg (http://radikal.ru/F/s19.radikal.ru/i192/1001/ca/8f679f61ec2d.png.html)
Всем спасибо, но мне уже помогли

Colapse
04-01-2010, 00:42
вот скрипт

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{35133CCE-057F-4218-9C63-007B8E03A776}
AppName=My Program
AppVerName=My Program
DefaultDirName={pf}\My Program
DefaultGroupName=My Program
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
WizardImageFile=D:\image\WizardImage.bmp
WizardSmallImageFile=D:\image\WizardSmallImage.bmp
DiskSliceSize=1400000000
SlicesPerDisk=1


[Languages]
Name: "default"; MessagesFile: "compiler:Default.isl"
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "C:\Program Files\Inno Setup 5\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\image\button.bmp"; DestDir: "{tmp}"; Flags: dontcopy
Source: "D:\image\black_folder.bmp"; DestDir: "{tmp}"; Flags: dontcopy
Source: "D:\image\background.bmp"; DestDir: "{tmp}"; Flags: dontcopy
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\My Program"; Filename: "{app}\MyProg.exe"
Name: "{commondesktop}\My Program"; Filename: "{app}\MyProg.exe"; Tasks: desktopicon

[Run]
Filename: "{app}\MyProg.exe"; Description: "{cm:LaunchProgram,My Program}"; Flags: nowait postinstall skipifsilent

[code]
const
ButtonWidth = 80; //Указываем размер кнопок
ButtonHeight = 23;

bidBack = 0;
bidNext = 1;
bidCancel = 2;
bidDirBrowse = 3;
bidGroupBrowse = 4;

var
ButtonPanel: array [0..4] of TPanel;
ButtonImage: array [0..4] of TBitmapImage;
ButtonLabel: array [0..4] of TLabel;

procedure ButtonLabelClick(Sender: TObject);
var
Button: TButton;
begin
ButtonImage[TLabel(Sender).Tag].Left:=0
case TLabel(Sender).Tag of
bidBack: Button:=WizardForm.BackButton
bidNext: Button:=WizardForm.NextButton
bidCancel: Button:=WizardForm.CancelButton
bidDirBrowse: Button:=WizardForm.DirBrowseButton
bidGroupBrowse: Button:=WizardForm.GroupBrowseButton
else
Exit
end
Button.OnClick(Button)
end;

procedure ButtonLabelMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if ButtonLabel[TLabel(Sender).Tag].Enabled then
ButtonImage[TLabel(Sender).Tag].Left:=-ButtonWidth
end;

procedure ButtonLabelMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
ButtonImage[TLabel(Sender).Tag].Left:=0
end;

procedure LoadButtonImage(AButton: TButton; AButtonIndex: integer);
var
Image: TBitmapImage;
Panel: TPanel;
Labl: TLabel;

begin
Panel:=TPanel.Create(WizardForm)
Panel.Left:=AButton.Left
Panel.Top:=AButton.Top
Panel.Width:=AButton.Width
Panel.Height:=AButton.Height
Panel.Tag:=AButtonIndex
Panel.Parent:=AButton.Parent
ButtonPanel[AButtonIndex]:=Panel

Image:=TBitmapImage.Create(WizardForm) //Рисунок который ложится на кнопку
Image.Width:=160 //Обязательно прописать оригинальный размер рисунка
Image.Height:=23
Image.Enabled:=False
Image.Bitmap.LoadFromFile(ExpandConstant('{tmp}\button.bmp'))
Image.Parent:=Panel
ButtonImage[AButtonIndex]:=Image

with TLabel.Create(WizardForm) do begin
Tag:=AButtonIndex
Parent:=Panel
Width:=Panel.Width
Height:=Panel.Height
Transparent:=True
OnClick:=@ButtonLabelClick
OnDblClick:=@ButtonLabelClick
OnMouseDown:=@ButtonLabelMouseDown
OnMouseUp:=@ButtonLabelMouseUp
end

Labl:=TLabel.Create(WizardForm) //Текст кнопок
Labl.Left:=13 //Указываем положение текста
Labl.Top:=5
Labl.Autosize:=True
Labl.Alignment:=taCenter
Labl.Tag:=AButtonIndex
Labl.Transparent:=True
Labl.Font.Color:=clWhite //Цвет текста
Labl.Caption:=AButton.Caption
Labl.OnClick:=@ButtonLabelClick
Labl.OnDblClick:=@ButtonLabelClick
Labl.OnMouseDown:=@ButtonLabelMouseDown
Labl.OnMouseUp:=@ButtonLabelMouseUp
Labl.Parent:=Panel
ButtonLabel[AButtonIndex]:=Labl
end;

procedure UpdateButton(AButton: TButton;AButtonIndex: integer);
begin
ButtonLabel[AButtonIndex].Caption:=AButton.Caption
ButtonPanel[AButtonIndex].Visible:=AButton.Visible
ButtonLabel[AButtonIndex].Enabled:=Abutton.Enabled
end;

procedure LicenceAcceptedRadioOnClick(Sender: TObject);
begin
ButtonLabel[bidNext].Enabled:=True
end;

procedure LicenceNotAcceptedRadioOnClick(Sender: TObject);
begin
ButtonLabel[bidNext].Enabled:=False
end;

procedure CurPageChanged1(CurPageID: Integer);
begin
UpdateButton(WizardForm.BackButton,bidBack)
UpdateButton(WizardForm.NextButton,bidNext)
UpdateButton(WizardForm.CancelButton,bidCancel)
end;

procedure InitializeWizard1();
begin
WizardForm.BackButton.Width:=ButtonWidth
WizardForm.BackButton.Height:=ButtonHeight

WizardForm.NextButton.Width:=ButtonWidth
WizardForm.NextButton.Height:=ButtonHeight

WizardForm.CancelButton.Width:=ButtonWidth
WizardForm.CancelButton.Height:=ButtonHeight

WizardForm.DirBrowseButton.Left:=337
WizardForm.DirBrowseButton.Width:=ButtonWidth
WizardForm.DirBrowseButton.Height:=ButtonHeight

WizardForm.GroupBrowseButton.Left:=337
WizardForm.GroupBrowseButton.Width:=ButtonWidth
WizardForm.GroupBrowseButton.Height:=ButtonHeight

WizardForm.LicenseAcceptedRadio.OnClick:=@LicenceAcceptedRadioOnClick

WizardForm.LicenseNotAcceptedRadio.OnClick:=@LicenceNotAcceptedRadioOnClick

ExtractTemporaryFile('button.bmp')
LoadButtonImage(WizardForm.BackButton,bidBack)
LoadButtonImage(WizardForm.NextButton,bidNext)
LoadButtonImage(WizardForm.CancelButton,bidCancel)
LoadButtonImage(WizardForm.DirBrowseButton,bidDirBrowse)
LoadButtonImage(WizardForm.GroupBrowseButton,bidGroupBrowse)
end;

procedure InitializeWizard2();
begin
with WizardForm do begin
with MainPanel do
Height := Height - 1;
with WizardSmallBitmapImage do begin
Left := 0;
Top := 0;
Height := 55; //Размер рисунка
Width := 483; //
end;
with PageNameLabel do begin
Font.Name := 'Tahoma'
Width := Width - 483; //Поставьте здесь значения на 0, если хотите вернуть текст
Left := Left + 483; //
end;
with PageDescriptionLabel do begin
Font.Name := 'Tahoma'
Width := Width - 483; //Поставьте здесь значения на 0, если хотите вернуть текст
Left := Left + 483; //
end;
end;
end;

const
Color = clblack;

procedure InitializeWizard3();
begin
WizardForm.PageNameLabel.Font.Color:=clWhite;
WizardForm.Font.Color:=clWhite;
WizardForm.Color:=Color;
WizardForm.WelcomePage.Color:=Color;
WizardForm.InnerPage.Color:=Color;
WizardForm.FinishedPage.Color:=Color;
WizardForm.LicensePage.Color:=Color;
WizardForm.PasswordPage.Color:=Color;
WizardForm.InfoBeforePage.Color:=Color;
WizardForm.UserInfoPage.Color:=Color;
WizardForm.SelectDirPage.Color:=Color;
WizardForm.SelectComponentsPage.Color:=Color;
WizardForm.SelectProgramGroupPage.Color:=Color;
WizardForm.SelectTasksPage.Color:=Color;
WizardForm.ReadyPage.Color:=Color;
WizardForm.PreparingPage.Color:=Color;
WizardForm.InstallingPage.Color:=Color;
WizardForm.InfoAfterPage.Color:=Color;
WizardForm.DirEdit.Color:=Color;
WizardForm.DiskSpaceLabel.Color:=Color;
WizardForm.DirEdit.Color:=Color;
WizardForm.GroupEdit.Color:=Color;
WizardForm.PasswordLabel.Color:=Color;
WizardForm.PasswordEdit.Color:=Color;
WizardForm.PasswordEditLabel.Color:=Color;
WizardForm.ReadyMemo.Color:=Color;
WizardForm.TypesCombo.Color:=Color;
WizardForm.WelcomeLabel1.Color:=Color;
WizardForm.InfoBeforeClickLabel.Color:=Color;
WizardForm.MainPanel.Color:=Color;
WizardForm.PageNameLabel.Color:=Color;
WizardForm.PageDescriptionLabel.Color:=Color;
WizardForm.ReadyLabel.Color:=Color;
WizardForm.FinishedLabel.Color:=Color;
WizardForm.YesRadio.Color:=Color;
WizardForm.NoRadio.Color:=Color;
WizardForm.WelcomeLabel2.Color:=Color;
WizardForm.LicenseLabel1.Color:=Color;
WizardForm.InfoAfterClickLabel.Color:=Color;
WizardForm.ComponentsList.Color:=Color;
WizardForm.ComponentsDiskSpaceLabel.Color:=Color;
WizardForm.BeveledLabel.Color:=Color;
WizardForm.StatusLabel.Color:=Color;
WizardForm.FilenameLabel.Color:=Color;
WizardForm.SelectDirLabel.Color:=Color;
WizardForm.SelectStartMenuFolderLabel.Color:=Color;
WizardForm.SelectComponentsLabel.Color:=Color;
WizardForm.SelectTasksLabel.Color:=Color;
WizardForm.LicenseAcceptedRadio.Color:=Color;
WizardForm.LicenseNotAcceptedRadio.Color:=Color;
WizardForm.UserInfoNameLabel.Color:=Color;
WizardForm.UserInfoNameEdit.Color:=Color;
WizardForm.UserInfoOrgLabel.Color:=Color;
WizardForm.UserInfoOrgEdit.Color:=Color;
WizardForm.PreparingLabel.Color:=Color;
WizardForm.FinishedHeadingLabel.Color:=Color;
WizardForm.UserInfoSerialLabel.Color:=Color;
WizardForm.UserInfoSerialEdit.Color:=Color;
WizardForm.TasksList.Color:=Color;
WizardForm.RunList.Color:=Color;
WizardForm.SelectDirBrowseLabel.Color:=Color;
WizardForm.SelectStartMenuFolderBrowseLabel.Color:=Color;
end;

procedure InitializeWizard4();
begin
ExtractTemporaryFile('black_folder.bmp');
WizardForm.SelectDirBitmapImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\black_folder.bmp'));
WizardForm.SelectDirBitmapImage.AutoSize:=true;
WizardForm.SelectGroupBitmapImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\black_folder.bmp'));
WizardForm.SelectGroupBitmapImage.AutoSize:=true;
end;

var
WelcomeLabel1, WelcomeLabel2: TLabel;
BmpFile: TBitmapImage;

procedure InitializeWizard6();
begin
ExtractTemporaryFile('background.bmp');

BmpFile:= TBitmapImage.Create(WizardForm);
BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\background.bmp'));
BmpFile.SetBounds(0, 0, 483, 313);
BmpFile.Stretch:= true
BmpFile.Parent:= WizardForm.WelcomePage;

with WizardForm do
begin
WelcomeLabel1.Hide;
WelcomeLabel2.hide;
end;

WelcomeLabel1:= TLabel.Create(WizardForm);
with WelcomeLabel1 do
begin
WelcomeLabel1.Alignment:=taCenter;
Left:= ScaleX(176);
Top:= ScaleY(66);
Width:= ScaleX(301);
Height:= ScaleY(71);
AutoSize:= false;
Transparent:= true;
WordWrap:= true;
Font.Name:='Arial'
Font.Size:= 12;
Font.Color:=ClWhite
Parent:= WizardForm.WelcomePage;
Caption:= WizardForm.WelcomeLabel1.Caption;
end;

WelcomeLabel2:=TLabel.Create(WizardForm);
with WelcomeLabel2 do
begin
WelcomeLabel2.Alignment:=taCenter;
Top:= ScaleY(136);
Left:= ScaleX(176);
Width:= ScaleX(301);
Height:= ScaleY(300);
AutoSize:= false;
WordWrap:= true;
Font.Color:=ClWhite
Font.Name:='Tahoma'
Transparent:= true;
Parent:= WizardForm.WelcomePage;
Caption:= WizardForm.WelcomeLabel2.Caption;
end;
end;

procedure CurPageChanged(CurPageID: Integer);
begin
CurPageChanged1(CurPageID);
end;

procedure InitializeWizard();
begin
InitializeWizard1();
InitializeWizard2();
InitializeWizard3();
InitializeWizard4();
InitializeWizard6();
end;

не могу его соединить с Ultimate Test Black!А также не знаю как сделать страницу завершения такой же как и приветствия.Help please!

REXE
04-01-2010, 13:20
Подскажите пожалуйста код запроса второго диска для скрипта распаковки фриарк архивов,буду благодарен)

ZanyGamer
04-01-2010, 14:06
В завершающем окне есть 3 чикбокса, допустим поснимал со всех галочку, потом хочу обратно все 3 вернуть, но получается что ставится только 1 из 3


[Setup]
SourceDir=.
OutputDir=Setup
AppName=111
AppVerName=111
AppVersion=111
AppPublisher=111
AppCopyright=111
AppPublisherURL=111
AppSupportURL=111
AppUpdatesURL=111
DefaultDirName={pf}\111
DefaultGroupName=111
AllowNoIcons=yes
OutputBaseFilename=setup
WizardImageFile=C:\Мои документы\111.bmp
WizardSmallImageFile=C:\Мои документы\111.bmp
SetupIconFile=C:\Мои документы\111.ico
WindowVisible=no
WindowShowCaption=no
WindowResizable=no
Compression=lzma/ultra
SolidCompression=yes

[Languages]
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"

[Files]
Source: "C:\Мои документы\111.bmp"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression solidbreak
Source: "isgsg.dll"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression solidbreak
Source: "E:\Games\111\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs sortfilesbyextension

[Icons]
Name: "{group}\111"; Filename: "{app}\Frozen Throne.exe"; WorkingDir: "{app}";
Name: "{userdesktop}\111"; Filename: "{app}\Frozen Throne.exe"; WorkingDir: "{app}"; Tasks: desktopicon;
Name: "{group}\111"; Filename: "{app}\BigTorrents.ru.exe"; WorkingDir: "{app}";
Name: "{userdesktop}\111"; Filename: "{app}\BigTorrents.ru.exe"; WorkingDir: "{app}"; Tasks: desktopicon;
Name: "{group}\{cm:UninstallProgram,111}"; Filename: "{uninstallexe}"

[Run]
Description: "{cm:LaunchProgram, 111}"; Filename: "{app}\111.exe"; WorkingDir: "{app}"; Flags: nowait postinstall skipifsilent
Description: "Посетить сайт"; Filename: "{app}\111.exe"; WorkingDir: "{app}"; Flags: nowait postinstall skipifsilent
Description: "Посмотреть историю версий"; Filename: "{app}\История версий.txt"; Flags: postinstall shellexec skipifsilent

[UninstallDelete]
Type: filesandordirs; Name: "{app}"

[Code]
const
dURL=2;

var
URLLabel,URLLabelShadow:TLabel;

procedure ShowSplashScreen(p1:HWND;p2:string;p3,p4,p5,p6,p7:integer;p8:boolean;p9:Cardinal;p10:integer); external 'ShowSplashScreen@files:isgsg.dll stdcall delayload';

procedure URLLabelClick(Sender: TObject);
var
ErrorCode:integer;
begin
ShellExec('open','http://111/','','',SW_SHOWNORMAL,ewNoWait,ErrorCode);
end;

procedure URLLabelMouseDown(Sender:TObject;Button:TMouseButton;Shift:TShiftState;X,Y:Integer);
begin
URLLabel.Top:=URLLabel.Top+dURL;
URLLabel.Left:=URLLabel.Left+dURL;
URLLabel.Font.Style:=URLLabel.Font.Style+[fsUnderline];
URLLabel.Font.Color:=clBlue;
URLLabelShadow.Visible:=False;
end;

procedure URLLabelMouseUp(Sender:TObject;Button:TMouseButton;Shift:TShiftState;X,Y:Integer);
begin
URLLabel.Top:=URLLabel.Top-dURL;
URLLabel.Left:=URLLabel.Left-dURL;
URLLabel.Font.Style:=URLLabel.Font.Style-[fsUnderline];
URLLabel.Font.Color:=clMaroon;
URLLabelShadow.Visible:=True;
end;

procedure RunListClickCheck(Sender: TObject);
var
i:integer;
begin
if WizardForm.RunList.Checked[WizardForm.RunList.ItemIndex] then begin
for i:=0 to WizardForm.RunList.Items.Count-1 do
WizardForm.RunList.Checked[i]:=False;
WizardForm.RunList.Checked[WizardForm.RunList.ItemIndex]:=True;
end;
end;

procedure InitializeWizard;
begin
WizardForm.RunList.OnClickCheck:=@RunListClickCheck;
URLLabelShadow:=TLabel.Create(WizardForm);
with URLLabelShadow do begin
Top:=ScaleY(331);
Left:=ScaleX(25);
Caption:='http://111/';
AutoSize:=True;
Parent:=WizardForm;
Transparent:=True;
Font.Color:=$00FF00;
Font.Size:=9;
Font.Style:=Font.Style+[fsBold];
end;
URLLabel:=TLabel.Create(WizardForm);
with URLLabel do begin
Top:=ScaleY(331)-dURL;
Left:=ScaleX(25)-dURL;
Caption:='http://111/';
AutoSize:=True;
Parent:=WizardForm;
Cursor:=crHand;
Transparent:=True;
Font.Color:=clBlack;
Font.Size:=9;
Font.Style:=Font.Style+[fsBold];
BringToFront;
OnClick:=@URLLabelClick;
OnMouseDown:=@URLLabelMouseDown;
OnMouseUp:=@URLLabelMouseUp;
end;
ExtractTemporaryFile('bt.bmp');
ShowSplashScreen(WizardForm.Handle,ExpandConstant('{tmp}')+'\bt.bmp',750,1000,750,0,255,False,$FFFFF F,10);
end;

procedure CurPageChanged(CurPageID: Integer);
begin
if (CurPageID=wpFinished) or (CurPageID=wpInfoAfter) then
WizardForm.RunList.Checked[0]:=True;
end;

REXE
04-01-2010, 22:42
Подскажите пожалуйта,использую я разделение на несколько setup.bin,как мне сделать чтобы они назывались не setup-1 и не setup-2.bin а например setup-1a и setup-1b.bin ??

A1EXXX
05-01-2010, 10:30
REXE, в родной справке искать не пробовал? :teeth:

ZanyGamer
05-01-2010, 12:30
Разобрался!
Где-то брал не помню на этом форуме или нет скрипт с procedure InitializeWizard; - в нём косяк!
Так что если у кого-то
В завершающем окне есть 3 чикбокса, допустим поснимал со всех галочку, потом хочу обратно все 3 вернуть, но получается что ставится только 1 из 3 »
Такая же ситуация, то знайте в чём трабла!

Спасибо что создали такую тему буквально "для чайников". Ну конечно не совсем, но кто голову имеет - по кусочкам соберёт красивый инсталер!


procedure InitializeWizard;
begin
WizardForm.RunList.OnClickCheck:=@RunListClickCheck;
URLLabelShadow:=TLabel.Create(WizardForm);
with URLLabelShadow do begin
Top:=ScaleY(331);
Left:=ScaleX(25);
Caption:='http://Bigtorrents.ru/';
AutoSize:=True;
Parent:=WizardForm;
Transparent:=True;
Font.Color:=$00FF00;
Font.Size:=9;
Font.Style:=Font.Style+[fsBold];
end;
URLLabel:=TLabel.Create(WizardForm);
with URLLabel do begin
Top:=ScaleY(331)-dURL;
Left:=ScaleX(25)-dURL;
Caption:='http://Bigtorrents.ru/';
AutoSize:=True;
Parent:=WizardForm;
Cursor:=crHand;
Transparent:=True;
Font.Color:=clBlack;
Font.Size:=9;
Font.Style:=Font.Style+[fsBold];
BringToFront;
OnClick:=@URLLabelClick;
OnMouseDown:=@URLLabelMouseDown;
OnMouseUp:=@URLLabelMouseUp;
end;
ExtractTemporaryFile('bt.bmp');
ShowSplashScreen(WizardForm.Handle,ExpandConstant('{tmp}')+'\bt.bmp',750,1000,750,0,255,False,$FFFFF F,10);
end;

procedure CurPageChanged(CurPageID: Integer);
begin
if (CurPageID=wpFinished) or (CurPageID=wpInfoAfter) then
WizardForm.RunList.Checked[0]:=True;
end;

Unsane
05-01-2010, 15:03
Можно ли в секции [code] отключить создание деинсталлятора (аналогично Uninstallable=no)?

serg aka lain
05-01-2010, 21:06
Можно ли в секции [code] отключить создание деинсталлятора (аналогично Uninstallable=no)? »
Отключить, думаю нет. Но можно его удалить, сразу после завершения установки.

Sotonisto
06-01-2010, 07:38
У меня есть 4 вопроса.

1. Как сделать картинку фоном инсталлятора? Вот так, только без логотипа, белой полосы и черно пространства?
>>> http://s54.radikal.ru/i143/1001/fc/251dc65b26d6.jpg
Ну что бы была картинка на весь инсталл и во всех диалогах (да и надпись приветствия желательно по центру разместить).
Дайте плз скрипт, или ссылку, где все подробно описано.

3. Можно ли изменить стандартную рамку инсталла, например, на черную?
>>> http://s15.radikal.ru/i189/1001/dd/da66e7110cff.jpg

4. Как заменить стандарный прогресс бар (просто полоса) на прогресс бар с делениями?

ZanyGamer
06-01-2010, 07:50
Думаю примеры которые просит Sotonisto, нужно в шапку кинуть, т.к. очень много задавали эти вопросы! На все я видел ответы на разных страницах, дабы не перебирать все страницы (больше 100) считаю целесообразным засунуть эти скрипты в шапку и желательно с вложенными картинками и стилем. Будет просто здорово!

YURSHAT
06-01-2010, 09:15
1. Как сделать картинку фоном инсталлятора? Вот так, только без логотипа, белой полосы и черно пространства? »
Примерно так (http://forum.ru-board.com/topic.cgi?forum=5&topic=30413&start=2228&limit=1&m=2#1)

3. Можно ли изменить стандартную рамку инсталла, например, на черную? »
Можно, применив скин Tiger.cjstyles

Думаю примеры которые просит Sotonisto, нужно в шапку кинуть, » Пример с картинкой итак есть в шапке!!! А вообще этот вопрос уже жован-пережован 100 раз!!!

Sotonisto
06-01-2010, 11:40
Примерно так »
Я посмотрел и ужаснулся :)
Я и в шапке скрипт видел, но чет у меня траблы начинаются, когда черные кнопки пытаюсь сделать ((

В конце скрипта на картинку для инсталлера есть такой код:
procedure CurPageChanged(CurPageID: Integer);
begin
pnl:= TPanel.Create(WizardForm);
with pnl do
begin
Align:= alClient;
Parent:= WizardForm;
end;
with WizardForm do
begin
with WizardBitmapImage do
begin
Align:= alClient;
Stretch:= True;
Parent:= pnl;
end;
NextButton.Parent:= pnl;
CancelButton.Parent:= pnl;
BackButton.Parent:= pnl;
Bevel.Parent:= pnl;
pnl.Repaint;
end;

if (CurPageID > wpWelcome) and (CurPageID < wpFinished) then
begin
WizardForm.Bevel1.Parent:= pnl;
with TLabel.Create(pnl) do
begin
AutoSize:= WizardForm.PageNameLabel.AutoSize;
SetBounds(WizardForm.PageNameLabel.Left,WizardForm.PageNameLabel.Top,
WizardForm.PageNameLabel.Width,WizardForm.PageNameLabel.Height);
Caption:= WizardForm.PageNameLabel.Caption;
with Font do
begin
Color:= WizardForm.PageNameLabel.Font.Color;
Style:= WizardForm.PageNameLabel.Font.Style;
Name:= WizardForm.PageNameLabel.Font.Name;
Size:= WizardForm.PageNameLabel.Font.Size;
end;
Transparent:= True;
Parent:= pnl;
end;
with TLabel.Create(pnl) do
begin
AutoSize:= WizardForm.PageDescriptionLabel.AutoSize;
SetBounds(WizardForm.PageDescriptionLabel.Left,WizardForm.PageDescriptionLabel.Top,
WizardForm.PageDescriptionLabel.Width,WizardForm.PageDescriptionLabel.Height);
Caption:= WizardForm.PageDescriptionLabel.Caption;
with Font do
begin
Color:= WizardForm.PageDescriptionLabel.Font.Color;
Style:= WizardForm.PageDescriptionLabel.Font.Style;
Name:= WizardForm.PageDescriptionLabel.Font.Name;
Size:= WizardForm.PageDescriptionLabel.Font.Size;
end;
Transparent:= True;
Parent:= pnl;
end;
pnl.Repaint;
end;

if CurPageID = wpWelcome then WelcomePage;
if CurPageID = wpSelectDir then SelectDirPage;
if CurPageID = wpReady then ReadyPage;
if CurPageID = wpInstalling then InstallingPage;
if CurPageID = wpFinished then FinishedPage;
end;
Он конфликтует с этой строкой - она для замены кнопок:
procedure CurPageChanged(CurPageID: Integer);
begin
UpdateButton(WizardForm.BackButton,bidBack)
UpdateButton(WizardForm.NextButton,bidNext)
UpdateButton(WizardForm.CancelButton,bidCancel)
end;

Если чет перенести - ничего не пашет =( Я в инно сетапе пока что профан, так что не знаю что делать =(

Плюс вот такое вот во время принятия лицензии/выбора папки в меню пуск/устанавливать директ и т.д.
http://i053.radikal.ru/1001/d5/387830148806t.jpg (http://radikal.ru/F/i053.radikal.ru/1001/d5/387830148806.jpg.html)
Просто ничего не видно и все ((

И еще я хочу избавится от белых полос (они портят картинку). Я видел пару раз инстал без них и мне тож захотелось примерно такой же сделать.

Пример с картинкой итак есть в шапке!!! А вообще этот вопрос уже жован-пережован 100 раз!!! »
Я б качнул руководство от Kindly, но у меня айпи не выделенный, так что про скачивание с рапида можно забыть ((

Можно, применив скин Tiger.cjstyles»
Напиши пример строки плз.

З.Ы.: а как на счет прогресс-бара? ну на кряйняк ему же цвет можно как-то изменить?!

YURSHAT
06-01-2010, 13:07
Sotonisto
Он конфликтует с этой строкой - она для замены кнопок:
Можно сделать так: Первой процедуре CurPageChanged присвоить цифру 1 т.е.
procedure CurPageChanged1(CurPageID: Integer);
begin
бла-бла

Второй цифру 2

procedure CurPageChanged2(CurPageID: Integer);
begin
бла-бла (кнопки)

А в конце скрипта добавить это:

procedure CurPageChanged(CurPageID: Integer);
begin
CurPageChanged1(CurPageID);
CurPageChanged2(CurPageID);
end;

И еще я хочу избавится от белых полос (они портят картинку). Я видел пару раз инстал без них и мне тож захотелось примерно такой же сделать.

procedure InitializeWizard();
begin
WizardForm.Bevel.Hide
WizardForm.Bevel1.Hide
end;

Напиши пример строки плз.
Используйте прогу ISSkin. А Tiger.cjstyles даст вам черную строку заголовка

З.Ы.: а как на счет прогресс-бара? ну на кряйняк ему же цвет можно как-то изменить?!

Можно наложить на него текстурку
[Setup]
AppName=zz
DefaultGroupName=group
AppVerName=zzz
DefaultDirName={pf}\test
SolidCompression=false
InternalCompressLevel=none
Compression=none

#define PB_ImageFile "progress1.bmp"//картинка 1 на 19

[Files]
Source: D:\Программы\Inno Setup 5.2.2\Новая папка (4)\DLL\InnoCallback.dll; Flags: dontcopy ignoreversion
Source: {#PB_ImageFile}; DestDir: "{tmp}"; Flags: recursesubdirs ignoreversion
Source: {win}\help\*.hlp; DestDir: {app}\Files; Flags: external

[Code_]
type
TProc = procedure(HandleW, msg, idEvent, TimeSys: LongWord);

var
TimerID: LongWord;
intOldCurrWidth : Integer;
ProgressBar_BitmapImage: TBitmapImage;
ProgressBar_Edit : TEdit;
ProgressBar_ImageHeight : integer;

// Функции для работы с таймером
function WrapTimerProc(callback:TProc; paramcount:integer):longword; external 'wrapcallback@files:innocallback.dll stdcall';
function SetTimer(hWnd: LongWord; nIDEvent, uElapse: LongWord; lpTimerFunc: LongWord): LongWord; external 'SetTimer@user32.dll stdcall';
function KillTimer(hWnd: LongWord; nIDEvent: LongWord): LongWord; external 'KillTimer@user32.dll stdcall';

// Обработчик нажатия кнопки Отмена
procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
begin
if CurPageID = wpInstalling then // Просто спрячем наш Прогресс Бар
ProgressBar_Edit.Show;
end;

// Функция вызываемая по таймеру
procedure OnTimer(HandleW, msg, idEvent, TimeSys: LongWord);
var
CurrWidth : single;
begin
// Используем текущее состояние стандартного Прогресс Бара (ПБ)
with WizardForm.ProgressGauge do
begin
CurrWidth := ( Position * Width ) / Max; // Вычисляем какой ширины должен быть наш ПБ
if intOldCurrWidth <> Round( CurrWidth ) then // Если ширина пока что такая же, то не будем пока что рисовать, чтобы избежать лишних обновлений формы
begin
intOldCurrWidth := Round( CurrWidth );
// Теперича "рисуем" наш ПБ
ProgressBar_BitmapImage.SetBounds( 0, 0, intOldCurrWidth, ProgressBar_ImageHeight );
ProgressBar_BitmapImage.Show(); // Показываем его во всей красе
end;
end;
end;

procedure CurPageChanged(CurPageID: Integer);
var
pfunc: LongWord;
begin
if CurPageID = wpInstalling then
begin
// Устанавливаем таймер
pfunc := WrapTimerProc( @OnTimer, 4 );
TimerID := SetTimer( 0, 0, 100, pfunc );
intOldCurrWidth := 0;
end;

// Убираем таймер, когда находимся на последней странице.
if CurPageID = wpFinished then
KillTimer( 0, TimerID );
end;

Procedure InitializeWizard;
begin
// Создаем наш Edit, чтобы у нашего ПБ была более-менее нормальная рамка.
ProgressBar_Edit := TEdit.Create( WizardForm );
with ProgressBar_Edit do
begin
// Создаем его на месте стандартного ПБ
Left := WizardForm.ProgressGauge.Left;
Top := WizardForm.ProgressGauge.Top;
Width := WizardForm.ProgressGauge.Width;
Height := WizardForm.ProgressGauge.Height;
Enabled := False;
ReadOnly := True;
// Фоновый цвет делаем точно такой же как у формы.
Color := WizardForm.Color;
Parent := WizardForm.InstallingPage;
end;

// Распаковываем картинку для нашего ПБ
ExtractTemporaryFile( '{#PB_ImageFile}' );

ProgressBar_BitmapImage := TBitmapImage.Create( WizardForm );
with ProgressBar_BitmapImage do
begin
// Загружаем картинку
Bitmap.LoadFromFile( ExpandConstant( '{tmp}\' ) + '{#PB_ImageFile}' );
Parent := ProgressBar_Edit;
Stretch := True; // Он должен растягиваться
Hide; // Прячем его до поры до времени
end;

// Получаем высоту для картинки
ProgressBar_ImageHeight := ProgressBar_Edit.Height - 2;
// Прячем стандартный ПБ
WizardForm.ProgressGauge.Hide;
end;

procedure DeinitializeSetup();
begin
// Убираем таймер
KillTimer( 0, TimerID );
end;

GrizzlyMK
06-01-2010, 18:00
Помогите соединить 2 скрипта.
Оба скрипта в архиве, заранее спасибо.

serg aka lain
06-01-2010, 19:33
Inno Setup 5.3.7 (http://www.jrsoftware.org/isdl.php) released. Happy new year!

* The PrivilegesRequired [Setup] section directive can now be set to lowest. On Windows Vista and later this instructs Setup to not request elevated rights (via a User Account Control dialog) even if it was started by a member of the Administrators group. Do not use this setting unless you are sure your installation will run successfully on unprivileged accounts. On Windows NT/2000/XP/2003, lowest behaves the same as none.
* Added new Compiler IDE option: Autosave before compiling.
* [Tasks] section flags checkedonce and unchecked may now be combined. This combination specifies the task to be unchecked by default on the first install, and always unchecked by default on subsequent installs as well.
* A problem with "Not Implemented" errors when Setup or Uninstall was run on Windows 7 under special conditions such as from a non-interactive service was fixed.
* Changed the CodePrepareToInstall.iss example script to use the RunOnce registry key instead of a shortcut placed in {commonstartup}.
* Pascal Scripting: the Non Unicode compiler now has a PAnsiChar type just like the Unicode compiler.
* Added official Japanese translation.
* Unicode [Code] based on RemObjects Pascal Script SVN code revision 197.
* Minor tweaks.

Lancer2404
07-01-2010, 14:07
А как реализовать такую функцию.Когда выбран одим из компонентов то он запускается после инсталляции.А если не выбран то не запускается.пробовал функцию checked но в примере он спрашивает устанавливать или нет в любом случае.Может надо чтото исправить в коде

Drongo
07-01-2010, 16:07
Всем привет. Позвонил друг, попросил узнать, как сделать инсталятор с проверкой операционной системы на Висту. В коде я выделил красным цветом, что я добавил для того чтобы инсталятор проверил что ОС - является Вистой и установка пошла дальше. Добавил эту строку. Друг говорит, что вариант не проходит, пробовал на висте установить, значение ложное и не устанавливается.
(Pos('Vista', SystemVersionPanel.Text) = 0) then // Windows Vista (c любым SP или без него)
...
// Операционная система:
SystemVersionPanel.Color := $CCFFCC

DeviceKey := 'Software\Microsoft\Windows NT\CurrentVersion'
if not UsingWinNT then StringChange(DeviceKey, 'Windows NT', 'Windows')
RegQueryStringValue(HKLM, DeviceKey, 'ProductName', DeviceName)
if RegQueryStringValue(HKLM, DeviceKey, 'CSDVersion', DeviceKey) then
DeviceName := DeviceName + ' ' + DeviceKey
StringChange(DeviceName, 'Microsoft ', '')
SystemVersionPanel.Text := ' ' + DeviceName + ' сборка ' + IntToStr(Version.Major) + '.' + IntToStr(Version.Minor) +
'.' + IntToStr(Version.Build)

if (Pos('2000 Service Pack 4', SystemVersionPanel.Text) = 0) and // Windows 2000 SP4
(Pos('XP Service Pack 1', SystemVersionPanel.Text) = 0) and // Windows XP SP1
(Pos('XP Service Pack 2', SystemVersionPanel.Text) = 0) and // Windows XP SP2
(Pos('XP Service Pack 3', SystemVersionPanel.Text) = 0) and // Windows XP SP3
(Pos('Vista', SystemVersionPanel.Text) = 0) then // Windows Vista (c любым SP или без него)
begin
SystemVersionPanel.Color := $CCCCFF
ChangeText := True
end
...

Как сделать проверку чтобы на Висте условие удовлетворялось бы?

serg aka lain
07-01-2010, 19:34
Как сделать проверку чтобы на Висте условие удовлетворялось бы? »


[Setup]
AppName=My Program
AppVerName=My Program version
DefaultDirName={pf}\My Program
OutputDir=userdocs:My Program.

[Code]
function InitializeSetup: Boolean;
var
Version: TWindowsVersion;
S: String;
begin
GetWindowsVersionEx(Version);
S := 'Ваша операционная система не является Windows Vista.'
+ #13#13 'Продолжение невозможно!';

if Version.NTPlatform and (Version.Major = 6) and (Version.Minor = 0) then
Result := True
else
begin
SuppressibleMsgBox(S, mbCriticalError, MB_OK, MB_OK);
Exit;
end;

if (UsingWinNT = False) then
begin
SuppressibleMsgBox(S, mbCriticalError, MB_OK, MB_OK);
Exit;
end;

Result := True;
end;




© OSzone.net 2001-2012