cominno-setupolepascalscriptwinhttprequest

WinHttp.WinHttpRequest.send displays runtime error popup


I'm using a WinHttp.WinHttpRequest OLE object to do some networking from the PascalScript section of an Inno Setup installer. Minimum (simplified but complete) repro:

function HttpGet(url: string): string;
var
  request: variant;
begin
  try
    request := CreateOleObject('WinHttp.WinHttpRequest.5.1');
    request.Open('GET', 'http://no.such.com/', false);

    request.Send(); { The problem spot }

    if request.Status = 200 then begin
      Log('Success');
      result := request.ResponseText;
    end else
      Log('Failure');
  except
    Log(GetExceptionMessage());
  end;
end;

The happy path works fine, as does HTTP return codes other than 200. But if the server name or address can't be found, the Send()call pops up the following:

enter image description here

I wish to do my own error handling, thank you very much, and would prefer that users not be bothered by that message box.

Any hints on how to achieve this? Can it even be done?


Solution

  • That's just a standard exception popup from a debugger in the IDE. I'm not aware of a setting that could disable these popups.

    Anyway, the end user won't see this.