如何在Inno Setup中更改下载路径?

时间:2013-04-26 12:53:19

标签: inno-setup

我想在innosetup中使用静默安装下载并安装.net framework 4.5,使用以下条件我将检查.netframework 4.5是否可用,如果不是,我将使用shellexec从web下载。在这里我附上了代码。

function Framework45IsNotInstalled: Boolean;
var
 bVer4x5: Boolean;
 bSuccess: Boolean;
 iInstalled: Cardinal;
 strVersion: String;
 iPos: Cardinal;
 ErrorCode: Integer;
begin
 Result := True;
 bVer4x5 := False;

 bSuccess := RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v4\Full', 'Install', iInstalled);
 if (1 = iInstalled) AND (True = bSuccess) then
  begin
    bSuccess := RegQueryStringValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v4\Full', 'Version', strVersion);
    if (True = bSuccess) then
     Begin
        iPos := Pos('4.5.', strVersion);
        if (0 < iPos) then bVer4x5 := True;

     End
  end;

 if (True = bVer4x5) then begin
    Result := False;

end;
ShellExec('', 'http://go.microsoft.com/fwlink/?LinkId=225702','{app}', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);

end; 

现在我的疑问是,在开始下载时打开网页浏览器,它不会自动安装.net框架,用户需要手动安装,我希望innosetup在下载发生后自动安装,安装应该发生以沉默的方式。我能想到完成这项任务吗?

1 个答案:

答案 0 :(得分:1)

使用ShellExec()告诉默认浏览器下载内容时,您无法控制它的作用。 如果您希望以后能够运行它,则需要使用InnoTools Downloader之类的集成下载程序,或者只是要求用户在安装时运行它。

相关问题