开发者

Javascript receives ActiveX event only once

I've written an ActiveX control using ATL. I used the wizard to add support for connection points which added public IConnectionPointContainerImpl<CActiveX> and CProxy_IActiveXEvents<CActiveX>, where the CProxy_... is the wizard generated code to fire events.

I've defined a dispinterface as follows:

[ uuid(43ECB3DF-F004-4FAD-9BFB-79211A693C3A), helpstring("ActiveX Events") ] dispinterface _IActiveXEvents { properties: methods: [id(1)] void receiveCertificate([in] VARIAN开发者_如何学JAVAT_BOOL isPermissionGranted, [in] BSTR certificateXml); };

and included it in the coclass with [default,source] dispinterface _IActiveXEvents. To fire the event I call Fire_receiveCertificate(isGranted, _bstr_t(certXml.c_str()).copy()), which is defined in the wizard-code.

The following Javascript will receive the event

function ActiveXObject::receiveCertificate(permission, certificate) {
      alert("alert!");
  }

The problem is it only receives the event once, and I have to close and reopen IE to get it to receive the event again. Am I missing something?


If anyone is interested, I found the solution to this problem. I had registered the object in the ROT (running object table), but was not revoking any previously existing registrations. Thus, multiple registrations were appearing. Once I ensured I revoked previous registrations, events fired reliably.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜