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] VARIANT_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?