I'm trying to create a setup using Inno Setup which should autoupdate itself if there is a newer version of the installer available. For the download part I want to use the Inno Setup plugin "Inno Download Plugin v1.2" from "Mitrich Software"
update: this is the version check I'm currently using, it works good but has a slight delay when I run the setup
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;