WScript.CreateObject unloads the Windows Scripting host when an event handler prefix is ​​specified for WinHTTPRequest

According to the MSDN documentation, WinHTTPRequest has four event handlers that should be available by specifying an event handler prefix. Unfortunately, this causes the Windows Scripting Host to crash.

The following code crashes the Windows Scripting Host:

Set oHTTP = WScript.CreateObject( "WinHttp.WinHttpRequest.5.1", "oHTTP_" )

This code works very well:

Set oHTTP = WScript.CreateObject( "WinHttp.WinHttpRequest.5.1" )

Any thoughts on why?

+1
source share
1 answer

This is not part of the specification in any way. Desired programming rarely works.

Creates and returns a reference to an Automation object.

 CreateObject(servername.typename [, location])

Arguments

server_name

Mandatory. The name of the application that provides the object.

typename

. .

. , .

, , .

GetRef

, .

Set object.eventname = GetRef(procname)

. , .

. , .

procname

. , Sub Function, .

-3

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


All Articles