我正在使用Inno Setup Compiler(Pascal腳本)。 我的表單有一個圖像對象(TBitmapImage),我想提供從網址獲得的動態圖像。是否可以在Inno Setup腳本中靜默下載圖像(或其他類型的文件)?Inno Setup圖像下載
1
A
回答
2
它實際上可能使用InnoTools Downloader到從網上下載幾乎所有的東西。
0
Inno安裝程序沒有任何內置功能,但是,您可以使用爲您執行工作的批處理文件執行此操作。
1)下載喜歡命令行URL資源下載 - http://www.chami.com/free/url2file_wincon.html
關於如何使用它的一些技巧 - http://www.chami.com/tips/windows/062598W.html
2)在您的安裝
3包吧)創建批處理文件調用url2file.exe並將您的映像提取到應用程序目錄中
4)在initialize setup命令中調用該批處理文件Inno Setup安裝程序腳本
5)無論你想要的地方使用該圖像!
ps - 如果您在設置中使用圖像,請檢查是否允許不同的圖像加載..我不確定這一點。 讓我知道如果您有任何其他疑問
3
我會寫一個小的Win32程序,從Internet下載文件,如
program dwnld;
uses
SysUtils, Windows, WinInet;
const
PARAM_USER_AGENT = 1;
PARAM_URL = 2;
PARAM_FILE_NAME = 3;
function DownloadFile(const UserAgent, URL, FileName: string): boolean;
const
BUF_SIZE = 4096;
var
hInet, hURL: HINTERNET;
f: file;
buf: PByte;
amtc: cardinal;
amti: integer;
begin
result := false;
hInet := InternetOpen(PChar(UserAgent), INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);
try
hURL := InternetOpenUrl(hInet, PChar(URL), nil, 0, 0, 0);
try
GetMem(buf, BUF_SIZE);
try
FileMode := fmOpenWrite;
AssignFile(f, FileName);
try
Rewrite(f, 1);
repeat
InternetReadFile(hURL, buf, BUF_SIZE, amtc);
BlockWrite(f, buf^, amtc, amti);
until amtc = 0;
result := true;
finally
CloseFile(f);
end;
finally
FreeMem(buf);
end;
finally
InternetCloseHandle(hURL);
end;
finally
InternetCloseHandle(hInet);
end;
end;
begin
ExitCode := 0;
if ParamCount < 3 then
begin
MessageBox(0,
PChar(Format('%s: This program requires three command-line arguments.',
[ExtractFileName(ParamStr(0))])),
PChar(ExtractFileName(ParamStr(0))),
MB_ICONERROR);
Exit;
end;
if FileExists(ParamStr(PARAM_FILE_NAME)) then
DeleteFile(PChar(ParamStr(PARAM_FILE_NAME)));
if DownloadFile(ParamStr(PARAM_USER_AGENT), ParamStr(PARAM_URL),
ParamStr(PARAM_FILE_NAME)) then
ExitCode := 1;
end.
這個程序有三個命令行參數:用戶代理,以發送到Web服務器(可以是任何內容,例如「MyApp Setup Utility」),Internet上文件的URL以及正在創建的文件的文件名。如果下載失敗,程序的退出代碼爲0,如果下載成功,程序的退出代碼爲1
然後,在您的Inno Setup腳本中,您可以執行
[Files]
Source: "dwnld.exe"; DestDir: "{app}"; Flags: dontcopy
[Code]
function InitializeSetup: boolean;
var
ResultCode: integer;
begin
ExtractTemporaryFile('dwnld.exe');
if Exec(ExpandConstant('{tmp}\dwnld.exe'),
ExpandConstant('"{AppName} Setup Utility" "http://privat.rejbrand.se/sample.bmp" "{tmp}\bg.bmp"'),
'', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode) then
if ResultCode = 1 then
(* Now you can do something with the file ExpandConstant('{tmp}\bg.bmp') *);
end;
然而不幸的是,我知道沒有辦法通過它可以在運行時改變了WizardImageFile
...
相關問題
- 1. Inno Setup torrent下載執行
- 2. Inno Setup的卸載
- 3. Inno Setup中的國家/地區下載
- 4. Inno Setup中的全屏背景圖像
- 5. Inno Setup:調整卸載進度表格圖像
- 6. 更新圖標,Inno Setup的
- 7. 沒有Inno Setup的圖標
- 8. Inno Setup - Conditional DisableDirPage
- 9. GetComputerNameString Inno Setup的
- 10. 在Inno Setup的
- 11. Inno Setup:卸載用戶對話框
- 12. 使用inno setup卸載visual studio擴展
- 13. Inno Setup - 卸載多個應用程序
- 14. Inno Setup - 自動提交卸載提示
- 15. Inno Setup StringChangeEx失敗
- 16. Inno Setup/SUPPRESSMSGBOXES定製
- 17. Inno Setup - 關於#define
- 18. Inno Setup tmp阻止
- 19. Inno Setup的:在TInputQueryWizardPage
- 20. Inno Setup Set TInputQueryWizardPage Height
- 21. Inno Setup在[代碼]
- 22. 使用Inno Setup的
- 23. Inno Setup Sqlite3插件
- 24. Inno Setup DefaultDirName問題
- 25. Inno Setup with java application
- 26. Inno Setup Always on top
- 27. Inno setup枚舉器
- 28. Inno Setup:使用JSON
- 29. Inno Setup Download Plugin失敗,「下載失敗:無法創建文件」
- 30. Inno Setup - 基於任務或組件的條件下載