我正在尝试使用Inno Setup创建一个设置,如果有更新版本的安装程序可以自动进行自动更新。 对于下载部分,我想使用来自“Mitrich Software”的Inno Setup插件“Inno Download Plugin v1.2”
更新 这是我正在使用的版本检查,它运行良好,但在运行安装程序时有一点延迟
function DownloadFile(const AURL: string; var AResponse: string): Boolean;
var
WinHttpRequest: Variant;
begin
Result := True;
try
WinHttpRequest := CreateOleObject('WinHttp.WinHttpRequest.5.1');
WinHttpRequest.Open('GET', AURL, False);
WinHttpRequest.Send;
AResponse := WinHttpRequest.ResponseText;
except
Result := False;
AResponse := GetExceptionMessage;
end;
end;
procedure InitializeWizard;
var
response: string;
begin
if DownloadFile('{#MyAppVersionFile}', response) then
begin
if CompareStr(response,'{#MyAppVersion}') > 0 then
begin
MsgBox('{#MyAppName} v'+ response +' is available!' #13#10 'Please download the latest version!', mbInformation, MB_OK)
end;
end else
begin
MsgBox('Could not perform version check! Are you connected to the internet?', mbInformation, MB_OK)
end;
end;