How to catch an OleObject exception in Inno Setup?

So, I'm trying to request a message without an internet connection using the following modified code:

      WinHttpReq := CreateOleObject('WinHttp.WinHttpRequest.5.1');
      WinHttpReq.Open('POST', '<your_web_server>', false);
      WinHttpReq.SetRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
      try
        WinHttpReq.Send('data');
      except
           bla:= 'e';
      finally
           bla := 'f';
      end;

However, the exception does not get caught, and I get the feed from my application settings as follows:

enter image description here

How to handle OleObject exception in Inno Setup?

+4
source share
1 answer

Your code is incomplete, but the block try..exceptblocks all exceptions, including those that were selected by OLE objects. However, your screenshot shows the line number on which the exception was thrown, and so you ran the debugger.

, , try..except, " " IDE Inno Setup:

enter image description here

( ), , . , .

+7

Source: https://habr.com/ru/post/1528939/


All Articles