I am trying to call Javascript from my ActiveX (ATL C++) dll. From the research I have done you should connection points.
Added to my idl file
[
uuid(BDBFA5F9-B2CB-43b1-A414-CB6E3B15C6C2),
("Event interface for Test")
]
_ITestEvents
{
properties:
methods:
[id(1), helpstring("method Cancel")] void Cancel([in] char* x, [in] char* y);
};
Added to my class .h file
class ATL_NO_VTABLE CTest :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CTest, &CLSID_Test>,
public IConnectionPointContainerImpl<CTest>,
public CProxy_ITestEvents<CTest>,
public IObjectWithSiteImpl<CTest>,
public IObjectSafetyImpl<CTest,INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA>,
public IProvideClassInfo2Impl<&CLSID_Test, &__uuidof(_ITestEvents), &LIBID_Test3Lib>,
public IDispatchImpl<ITest, &IID_ITest, &LIBID_Test3Lib, /*wMajor =*/ 1, /*wMinor =*/ 0>
{
public:
BEGIN_COM_MAP(Clnaxprt)
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
COM_INTERFACE_ENTRY(Ilnaxprt)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IConnectionPointContainer)
COM_INTERFACE_ENTRY(IObjectWithSite)
COM_INTERFACE_ENTRY(IObjectSafety)
COM_INTERFACE_ENTRY(IProvideClassInfo)
COM_INTERFACE_ENTRY(IProvideClassInfo2)
END_COM_MAP()
BEGIN_CONNECTION_POINT_MAP(Clnaxprt)
CONNECTION_POINT_ENTRY(__uuidof(_ITestEvents))
END_CONNECTION_POINT_MAP()
In visual studio “implemented a new connection point” which generated code in the _ITestEvents_CP.h that was created with a method name Fire_Cancel( char * x, char * y). And that is where I am stuck. I have tried to call the Fire_Cancel and when debugging the generated code there are no connections and thus no Invoking from IDispatch. What do I do to create a connection?
Still not sure how the javascript works yet but want to get this part understood before I move to that.
Thanks
The HTML and Javascript in my case were wrong. If your using the notation “id::function_name” make sure it is afterthe object tag. If the notation is “for=id event=cancel” then it can be located before/after