Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'll admit his isn't a great answer, but the usual way to register VBScript events is to use the <code>GetRef</code> function to get a reference to the event handler, eg with an <code>MSXML2.XMLHTTP</code> object:</p> <pre><code>Set oHTTP = CreateObject("MSXML2.XMLHTTP") oHTTP.Open "GET", "http://www.google.com", True oHTTP.OnReadyStateChange = GetRef("oHTTP_OnReadyStateChange") Sub oHTTP_OnReadyStateChange ' do something End sub oHTTP.Send </code></pre> <p>The trouble is, I tried it for your code, ie</p> <pre><code>Set oHTTP = CreateObject("WinHttp.WinHttpRequest.5.1") oHTTP.Open "GET", "http://www.google.com", True oHTTP.OnResponseFinished = GetRef("oHTTP_OnResponseFinished") Sub oHTTP_OnResponseFinished ' do something End sub oHTTP.Send </code></pre> <p>and it didn't work, getting the error</p> <blockquote> <p>Object doesn't support this property or method: 'oHTTP.OnResponseFinished'</p> </blockquote> <p>but perhaps this can give you a starting point , or maybe you can use the <code>MSXML2</code> library instead?</p> <p>Just updating this answer with the <em>other</em> way of handling COM events - use the second parameter for the <code>CreateObject</code> function which allows you to specify the function prefix which connects functions to objects, eg</p> <pre><code>Set oHTTP = CreateObject("WinHttp.WinHttpRequest.5.1", "oHTTP_") oHTTP.Open "GET", "http://www.google.com", True Sub oHTTP_OnResponseFinished ' do something End sub oHTTP.Send </code></pre> <p>unfortunately, this doesn't work either - it must be that the <code>IWinHttpRequestEvents</code> interface is inaccessible</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload