VB XMLHTTP 异步调用

Set XmlHttp2 = CreateObject("Msxml2.XMLHTTP")
XmlHttp2.Open "GET", Url, True  
XmlHttp2.setRequestHeader "CONTENT-TYPE", "application/json;charset=utf-8"
XmlHttp2.send PostMsg

1、使用MSXML2.XMLHTTP open中参数设置为True

2、onreadystatechange 进行设置

方式有:1)使用Timer

              2)WithEvents声明的DomDocument对象load Xml

              3)自定义类,新建类方法来处理事件,然后把类赋给XMLHTTP对象的OnReadyStateChange事件

3、详细内容参考MSDN

https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ms757030(v=vs.85)

Use the onReadyStateChange Property (Visual Basic)

  • 10/27/2016
  • 4 minutes to read

This topic discusses the implementation details necessary to use onreadystatechange notification in Microsoft Visual Basic applications.

Background Information for onReadyStateChange events

The onreadystatechange callback function was not implemented as a COM automation event in the IXMLHTTPRequest and IServerXMLHTTPRequest components. This is because these components are heavily used in scripting environments, many of which do not support COM events. The onreadystatechange callback function was intended to be easy to use when working with scripting clients such as VBScript and JScript.

Because the onreadystatechange property was not implemented through COM-based automation events, Visual Basic (and C/C++) applications need to implement thi

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值