title: How to use "WinHttp.WinHttpRequest.5.1" asynchronously?
body: <p>The code:</p>
  
  <pre><code>var
    WinHttpReq: OleVariant;
  
  procedure TForm1.Button1Click(Sender: TObject);    
  begin
    WinHttpReq := CreateOleObject('WinHttp.WinHttpRequest.5.1');
    WinHttpReq.Open('GET', 'http://stackoverflow.com', TRUE); // asynchronously
    WinHttpReq.setRequestHeader('User-Agent', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0');
    WinHttpReq.Send();
    // HOW to set a callback procedure here and get the response?
  end;
  </code></pre>
  
  <p>Note: I do not want to import mshttp.dll and use TLB. I want to use it via late binding. I also would like to handle exceptions if any.</p>
  
  <p><strong>EDIT:</strong>
  I'm accepting TLama's answer becouse it gives me a good alternative to what I initially was asking. plus it has a good example source.</p>
  
  <p>Here is a very nice implementation of <a href="https://forums.embarcadero.com/thread.jspa?messageID=168727" rel="nofollow">WinHTTPRequest Wrapper with IConnectionPoint for Events</a> (source code is attached). </p>