ITDではなく他のダウンロードプラグインを使用します(理由は下記を参照)。
たとえば、Inno Download Plugin。
idp.iss
を含めると、グローバルIDPForm
構造が定義されます。そのPage
フィールドは、ダウンロードページを表すTWizardPage
です。 (自動的に「押し」されたダウンロードページで「次へ」ボタン)ダウンロードが完了後、ダウンロードしたファイルを実行するためにNextButtonClick
にそのIDを使用します。
#include <idp.iss>
[Code]
procedure InitializeWizard;
begin
idpAddFile(
'https://www-us.apache.org/dist/tomcat/tomcat-9/v9.0.0.M13/bin/' +
'apache-tomcat-9.0.0.M13-windows-x64.zip',
ExpandConstant('{tmp}\apache-tomcat-9.0.0.M13-windows-x64.zip'));
idpAddFile(
'https://www.example.com/jdk-8u111-windows-x64.exe',
ExpandConstant('{tmp}\jdk-8u111-windows-x64.exe'));
idpDownloadAfter(wpSelectDir);
end;
function NextButtonClick(CurPageID: Integer): Boolean;
var
ResultCode: Integer;
FileName: string;
begin
if CurPageID = IDPForm.Page.ID then
begin
FileName := ExpandConstant('{tmp}\jdk-8u111-windows-x64.exe');
Result := Exec(FileName, '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
if not Result then
begin
MsgBox('Cannot execute sub-installer', mbError, MB_OK);
end
else
begin
Result := (ResultCode = 0);
if not Result then
begin
MsgBox('Sub-installer failed', mbError, MB_OK);
end
end;
end
else
begin
Result := True;
end;
end;
あなたが使用して同じことを実現することができますがInnoTools Downloader、それを避ける必要があります:
- これは時代遅れであり、もはや維持されません。
- Unicode Innoセットアップはサポートされていません(新しいプロジェクトにはAnsi Innoセットアップを使用しないでください)。
- ダウンロードサポートHTTPS;
- ダウンロードページdoes not scale on high DPI。
とにかく、ITD_DownloadAfter
は、ダウンロードページを表すTWizardPage
を返します。 (ダウンロードページの「次へ」ボタンが自動的に「押し」された)、ダウンロードが完了すると、ダウンロードしたファイルを実行するためにNextButtonClick
にそのIDを使用します。
var
DownloadPage: TWizardPage;
procedure InitializeWizard();
begin
ITD_Init;
ITD_AddFile(
'http://www.example.com/jdk-8u111-windows-x64.exe',
ExpandConstant('{tmp}\jdk-8u111-windows-x64.exe'));
DownloadPage := ITD_DownloadAfter(wpSelectDir);
end;
function NextButtonClick(CurPageID: Integer): Boolean;
var
ResultCode: Integer;
begin
if CurPageID = DownloadPage.ID then
begin
Result :=
Exec(
ExpandConstant('{tmp}\jdk-8u111-windows-x64.exe'),
'', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
if not Result then
begin
MsgBox('Cannot execute sub-installer', mbError, MB_OK);
end
else
begin
Result := (ResultCode = 0);
if not Result then
begin
MsgBox('Sub-installer failed', mbError, MB_OK);
end
end;
end
else
begin
Result := True;
end;
end;
'wpXXX'定数ではなく、マジックナンバーを使用してください。 –
ITD_DownloadAfterを複数回呼び出すのは間違いです。 –
とにかくITDを使用しないでください。それは時代遅れです。 AnsiバージョンのInno Setupのみをサポートしています。そして、スケールしない。 125%ズームで見た目が醜いのを見てください。(網膜ディスプレイの高倍率でのみ)https://i.stack.imgur.com/QfA4k.png –