Кажется я не догнал .там вообще можно проще сделать
Код:procedure InitializeWizard(); var linksfile: TArrayofString; sfilesize: int64; i: integer; begin sfilesize:=0 linksfile:=['https://dl.google.com/tag/s/appguid%3D%7B8A69D345-D564-463C-AFF1-A69D9E530F96%7D%26iid%3D%7B852D1F37-DBB1-2329-EC47-10EC16BC8A29%7D%26lang%3Dru%26browser%3D5%26usagestats%3D1%26appname%3DGoogle%2520Chrome%26needsadmin%3Dprefers%26ap%3Dx64-statsdef_1%26installdataindex%3Dempty/update2/installers/ChromeSetup.exe', 'https://jrsoftware.org/download.php/iscrypt.dll'] for i:=0 to Length(linksfile)-1 do sfilesize:= sfilesize+DownloadTemporaryFileSize(linksfile[i]); WizardForm.DiskSpaceLabel.Caption:='Required:'+' '+ByteOrTB(sfilesize,true); end;
Ссылки через запятую ставить или как ?
[Setup]
AppVersion=1.5
AppName=My Prog
DefaultDirName=.\My Prog
ChangesAssociations=false
SolidCompression=no
OutputDir=.
Uninstallable=false
CreateUninstallRegKey=false
#if (Ver < 0x6010000)
[Files]
Source: idp\idp.dll; Flags: ignoreversion dontcopy noencryption
#endif
[Messages]
ButtonNext=Accept
ButtonCancel=Bay
ButtonBack=Prev
ButtonInstall=Go
ButtonFinish=Chao
[Code]
#define AW = (Defined UNICODE) ? "W" : "A"
#if (Ver < 0x6010000)
function idpDownloadFile(url, filename: String): Boolean;
external 'idpDownloadFile@{tmp}\idp.dll cdecl delayload';
function MessageBox(hWnd: HWND; lpText, lpCaption: string;
uType: UINT): Integer; external 'MessageBox{#AW}@user32.dll stdcall';
#endif
function DownloadFileApi(const URL: string): String;
var
WinHttpReq: Variant;
FileName: string;
begin
//Result := False;
try
WinHttpReq := CreateOleObject('WinHttp.WinHttpRequest.5.1');
WinHttpReq.Open('GET', URL, False);
WinHttpReq.Send('');
if WinHttpReq.Status = 200 then
begin
FileName := ExtractFileName(URL);
MsgBox('Имя файла: ' + FileName, mbInformation, MB_OK);
Result := FileName;
end;
except
Log('DownloadFile: Error downloading file from ' + URL);
end;
end;
function IFolder (Path: String): String;
var
minew:string;
begin
minew:=ExpandConstant('{username}');
Path:= AddBackslash(GetEnv(Path)) + ExpandConstant('{username}') ;
Result := Path;
end;
procedure InitializeWizard();
begin
#if (Ver < 0x6010000)
ExtractTemporaryFile('idp.dll')
#endif
WizardForm.WizardSmallBitmapImage.Hide;
WizardForm.WizardBitmapImage.Hide;
WizardForm.WizardBitmapImage2.Hide;
(* тут в ручную прописать
WizardForm.DiskSpaceLabel.Caption:='Required:'+' '+IntttoStr(сумма/1024/1024);
или делать
var
procedure InitializeWizard();
sfilesize: int64;
........
for i:=0 to Length(linksfile)-1 do
sfilesize:= sfilesize+DownloadTemporaryFileSize(linksfile[i]);
WizardForm.DiskSpaceLabel.Caption:='Required:'+' '+IntttoStr(sfilesize);
*)
end;
procedure CurPageChanged(CurPageID: Integer);
var
linksfile, downfilename: TArrayofString;
i: integer;
DownResult: Boolean;
begin
linksfile:=[
'https://dl.google.com/tag/s/appguid%3D%7B8A69D345-D564-463C-AFF1-A69D9E530F96%7D%26iid%3D%7B852D1F37-DBB1-2329-EC47-10EC16BC8A29%7D%26lang%3Dru%26browser%3D5%26usagestats%3D1%26appname%3DGoogle%2520Chrome%26needsadmin%3Dprefers%26ap%3Dx64-statsdef_1%26installdataindex%3Dempty/update2/installers/ChromeSetup.exe',
'https://jrsoftware.org/download.php/iscrypt.dll'
]
// downfilename:=['chrome.exe','iscrypt.dll']
if CurPageID = wpReady then begin
#if (Ver < 0x6010000)
CreateDir(ExpandConstant(IFolder('temp')))
for i:=0 to Length(linksfile)-1 do
//************* downloadfiles ******************
DownResult:= idpDownloadFile(linksfile[i],ExpandConstant(IFolder('temp')+'\'+DownloadFileApi(linksfile[i])));
UnloadDLL(ExpandConstant('{tmp}\idp.dll'));
if not DownResult then begin
MessageBox(0, 'Sorry, program could not be download.'+#13#10+'Please try again later...', 'Something went wrong:', MB_OK);
Beep;
UnloadDLL(ExpandConstant('{tmp}\idp.dll'));
Abort;
end;
//******************************************
#endif
#if (Ver >= 0x6010000)
for i:=0 to Length(linksfile)-1 do
//************* downloadfiles ******************
DownloadTemporaryFile(linksfile[i], DownloadFileApi(linksfile[i]), '', nil);
//****************************************** из темпа переместить или копировать куда надо
#endif
end;
end;
Согласен, но уже сделано тут.Вообще то нужно было тему новую открыть под это))
тут не много обновленный. как объявить массив как константу хз, поэтому 2 раза написанСогласен, но уже сделано тут.
[Setup]
AppVersion=1.5
AppName=My Prog
DefaultDirName=.\My Prog
OutputDir=.
Uninstallable=false
CreateUninstallRegKey=false
#if (Ver < 0x6010000)
[Files]
Source: idp\idp.dll; Flags: ignoreversion dontcopy noencryption
#endif
[Messages]
ButtonNext=Accept
ButtonCancel=Bay
ButtonBack=Prev
ButtonInstall=Go
ButtonFinish=Chao
[Code]
#define AW = (Defined UNICODE) ? "W" : "A"
#if (Ver < 0x6010000)
function idpDownloadFile(url, filename: String): Boolean;
external 'idpDownloadFile@{tmp}\idp.dll cdecl delayload';
function MessageBox(hWnd: HWND; lpText, lpCaption: string;
uType: UINT): Integer; external 'MessageBox{#AW}@user32.dll stdcall';
#endif
type
TDownloadResult = record
FileName: string;
FileSize: Integer;
end;
var
linksfile: TArrayofstring;
i: Integer;
DownloadResult: TDownloadResult;
function DownloadFileApi(const URL: string): TDownloadResult;
var
WinHttpReq: Variant;
FileName: string;
FileSize: Integer;
begin
Result.FileName := '';
Result.FileSize := 0;
try
WinHttpReq := CreateOleObject('WinHttp.WinHttpRequest.5.1');
WinHttpReq.Open('GET', URL, False);
WinHttpReq.Send('');
if WinHttpReq.Status = 200 then
begin
FileName := ExtractFileName(URL);
FileSize := StrToInt(WinHttpReq.GetResponseHeader('Content-Length'));
Result.FileName := FileName;
Result.FileSize := FileSize;
end;
except
Log('DownloadFileApi: Error downloading file from ' + URL);
end;
end;
function IFolder (Path: String): String;
var
minew:string;
begin
minew:=ExpandConstant('{username}');
Path:= AddBackslash(GetEnv(Path)) + ExpandConstant('{username}') ;
Result := Path;
end;
procedure InitializeWizard();
var
Summa: integer;
begin
#if (Ver < 0x6010000)
ExtractTemporaryFile('idp.dll')
#endif
linksfile := [
'https://dl.google.com/tag/s/appguid%3D%7B8A69D345-D564-463C-AFF1-A69D9E530F96%7D%26iid%3D%7B852D1F37-DBB1-2329-EC47-10EC16BC8A29%7D%26lang%3Dru%26browser%3D5%26usagestats%3D1%26appname%3DGoogle%2520Chrome%26needsadmin%3Dprefers%26ap%3Dx64-statsdef_1%26installdataindex%3Dempty/update2/installers/ChromeSetup.exe',
'https://jrsoftware.org/download.php/iscrypt.dll'
];
WizardForm.WizardSmallBitmapImage.Hide;
WizardForm.WizardBitmapImage.Hide;
WizardForm.WizardBitmapImage2.Hide;
for i := 0 to Length(linksfile) - 1 do
begin
DownloadResult := DownloadFileApi(linksfile[i]);
Summa:=Summa+DownloadResult.FileSize
//MsgBox('Имя файла: ' + DownloadResult.FileName + #13#10 + 'Размер файла: ' + IntToStr(DownloadResult.FileSize) + ' байтов', mbInformation, MB_OK);
// тут или в ручную прописать если много файлов висеть будет долго
WizardForm.DiskSpaceLabel.Caption:='Required:'+' '+InttoStr(Round(Summa/1024/1024))+ ' Mb';
end;
end;
procedure CurPageChanged(CurPageID: Integer);
var
DownResult:Boolean;
begin
linksfile := [
'https://dl.google.com/tag/s/appguid%3D%7B8A69D345-D564-463C-AFF1-A69D9E530F96%7D%26iid%3D%7B852D1F37-DBB1-2329-EC47-10EC16BC8A29%7D%26lang%3Dru%26browser%3D5%26usagestats%3D1%26appname%3DGoogle%2520Chrome%26needsadmin%3Dprefers%26ap%3Dx64-statsdef_1%26installdataindex%3Dempty/update2/installers/ChromeSetup.exe',
'https://jrsoftware.org/download.php/iscrypt.dll'
];
if CurPageID = wpReady then
begin
for i := 0 to Length(linksfile) - 1 do
begin
DownloadResult := DownloadFileApi(linksfile[i]);
#if (Ver < 0x6010000)
CreateDir(ExpandConstant(IFolder('temp')))
//************* downloadfiles ******************
DownResult:= idpDownloadFile(linksfile[i],ExpandConstant(IFolder('temp')+'\'+DownloadResult.FileName));
UnloadDLL(ExpandConstant('{tmp}\idp.dll'));
if not DownResult then begin
MessageBox(0, 'Sorry, program could not be download.'+#13#10+'Please try again later...', 'Something went wrong:', MB_OK);
Beep;
UnloadDLL(ExpandConstant('{tmp}\idp.dll'));
Abort;
end;
//******************************************
#endif
#if (Ver >= 0x6010000)
//************* downloadfiles ******************
DownloadTemporaryFile(linksfile[i], DownloadResult.FileName, '', nil);
//****************************************** из темпа переместить или копировать куда надо
#endif
//MsgBox('Имя файла: ' + DownloadResult.FileName + #13#10 + 'Размер файла: ' + IntToStr(DownloadResult.FileSize) + ' байтов', mbInformation, MB_OK);
end;
end;
end;
Жёстко зависает, размер отображает но сильно лагает и файлы не загружаются.тут не много обновленный. как объявить массив как константу хз, поэтому 2 раза написан
Код:[Setup] AppVersion=1.5 AppName=My Prog DefaultDirName=.\My Prog OutputDir=. Uninstallable=false CreateUninstallRegKey=false #if (Ver < 0x6010000) [Files] Source: idp\idp.dll; Flags: ignoreversion dontcopy noencryption #endif [Messages] ButtonNext=Accept ButtonCancel=Bay ButtonBack=Prev ButtonInstall=Go ButtonFinish=Chao [Code] #define AW = (Defined UNICODE) ? "W" : "A" #if (Ver < 0x6010000) function idpDownloadFile(url, filename: String): Boolean; external 'idpDownloadFile@{tmp}\idp.dll cdecl delayload'; function MessageBox(hWnd: HWND; lpText, lpCaption: string; uType: UINT): Integer; external 'MessageBox{#AW}@user32.dll stdcall'; #endif type TDownloadResult = record FileName: string; FileSize: Integer; end; var linksfile: TArrayofstring; i: Integer; DownloadResult: TDownloadResult; function DownloadFileApi(const URL: string): TDownloadResult; var WinHttpReq: Variant; FileName: string; FileSize: Integer; begin Result.FileName := ''; Result.FileSize := 0; try WinHttpReq := CreateOleObject('WinHttp.WinHttpRequest.5.1'); WinHttpReq.Open('GET', URL, False); WinHttpReq.Send(''); if WinHttpReq.Status = 200 then begin FileName := ExtractFileName(URL); FileSize := StrToInt(WinHttpReq.GetResponseHeader('Content-Length')); Result.FileName := FileName; Result.FileSize := FileSize; end; except Log('DownloadFileApi: Error downloading file from ' + URL); end; end; function IFolder (Path: String): String; var minew:string; begin minew:=ExpandConstant('{username}'); Path:= AddBackslash(GetEnv(Path)) + ExpandConstant('{username}') ; Result := Path; end; procedure InitializeWizard(); var Summa: integer; begin #if (Ver < 0x6010000) ExtractTemporaryFile('idp.dll') #endif linksfile := [ 'https://dl.google.com/tag/s/appguid%3D%7B8A69D345-D564-463C-AFF1-A69D9E530F96%7D%26iid%3D%7B852D1F37-DBB1-2329-EC47-10EC16BC8A29%7D%26lang%3Dru%26browser%3D5%26usagestats%3D1%26appname%3DGoogle%2520Chrome%26needsadmin%3Dprefers%26ap%3Dx64-statsdef_1%26installdataindex%3Dempty/update2/installers/ChromeSetup.exe', 'https://jrsoftware.org/download.php/iscrypt.dll' ]; WizardForm.WizardSmallBitmapImage.Hide; WizardForm.WizardBitmapImage.Hide; WizardForm.WizardBitmapImage2.Hide; for i := 0 to Length(linksfile) - 1 do begin DownloadResult := DownloadFileApi(linksfile[i]); Summa:=Summa+DownloadResult.FileSize //MsgBox('Имя файла: ' + DownloadResult.FileName + #13#10 + 'Размер файла: ' + IntToStr(DownloadResult.FileSize) + ' байтов', mbInformation, MB_OK); // тут или в ручную прописать если много файлов висеть будет долго WizardForm.DiskSpaceLabel.Caption:='Required:'+' '+InttoStr(Round(Summa/1024/1024))+ ' Mb'; end; end; procedure CurPageChanged(CurPageID: Integer); var DownResult:Boolean; begin linksfile := [ 'https://dl.google.com/tag/s/appguid%3D%7B8A69D345-D564-463C-AFF1-A69D9E530F96%7D%26iid%3D%7B852D1F37-DBB1-2329-EC47-10EC16BC8A29%7D%26lang%3Dru%26browser%3D5%26usagestats%3D1%26appname%3DGoogle%2520Chrome%26needsadmin%3Dprefers%26ap%3Dx64-statsdef_1%26installdataindex%3Dempty/update2/installers/ChromeSetup.exe', 'https://jrsoftware.org/download.php/iscrypt.dll' ]; if CurPageID = wpReady then begin for i := 0 to Length(linksfile) - 1 do begin DownloadResult := DownloadFileApi(linksfile[i]); #if (Ver < 0x6010000) CreateDir(ExpandConstant(IFolder('temp'))) //************* downloadfiles ****************** DownResult:= idpDownloadFile(linksfile[i],ExpandConstant(IFolder('temp')+'\'+DownloadResult.FileName)); UnloadDLL(ExpandConstant('{tmp}\idp.dll')); if not DownResult then begin MessageBox(0, 'Sorry, program could not be download.'+#13#10+'Please try again later...', 'Something went wrong:', MB_OK); Beep; UnloadDLL(ExpandConstant('{tmp}\idp.dll')); Abort; end; //****************************************** #endif #if (Ver >= 0x6010000) //************* downloadfiles ****************** DownloadTemporaryFile(linksfile[i], DownloadResult.FileName, '', nil); //****************************************** из темпа переместить или копировать куда надо #endif //MsgBox('Имя файла: ' + DownloadResult.FileName + #13#10 + 'Размер файла: ' + IntToStr(DownloadResult.FileSize) + ' байтов', mbInformation, MB_OK); end; end; end;
Inno Download Plugin (IDP) уже давно морально устарел (кривой интерфейс при включении параметра WizardStyle=modern). Лучше используй его более современный аналог Downloader for Inno Setup (DwinsHs). Поскольку ты используешь сборку Inno Setup 6.4.0 VCL, то в 7-Zip архиве чуть ниже уже правленный конфиг для сборки от Leserg. Там два примера: базовый с кастомным расположением прогрессбара и компонентный с WizardStyle = modern + два языка english/russian на выбор.Посмотреть вложение 9354
Посмотреть вложение 9355
Серый цвет Текст в середине, картинка просто скрыта, но отображение текста где - то в середине )
Благодарю.Inno Download Plugin (IDP) уже давно морально устарел (кривой интерфейс при включении параметра WizardStyle=modern). Лучше используй его более современный аналог Downloader for Inno Setup (DwinsHs). Поскольку ты используешь сборку Inno Setup 6.4.0 VCL, то в 7-Zip архиве чуть ниже уже правленный конфиг для сборки от Leserg. Там два примера: базовый с кастомным расположением прогрессбара и компонентный с WizardStyle = modern + два языка english/russian на выбор.
Посмотреть вложение 9358
По поводу текстуры, которая не отображается на странице завершения... Ты из файла ресурсов FH5Img.dat использовал изображение для ВНУТРЕННИХ/ВНЕШНИХ страниц мастера установки? У каждой текстуры свой индивидуальный индекс на страницах мастера установки, который надо указать в скрипте. В качестве примера скомпилируй скрипт example_wizard.iss из архива чуть ниже и потом загрузи файл AvP_patch, чтобы увидеть как можно на свой лад кастомизитовать интерфейс инсталлятора.