我正在使用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 - 基于任务或组件的条件下载