For the first two is kind of easy to import an activex inside yout project...
For .NET you either add a reference to a COM.. that is the ActiveX that is using a .NET Framework tool - aximp - to create two wrappers.
For catching an event in JS you have to write this code...
<script for="ActiveX_ID" event="EventName()">...code here...</script>
What about MFC? How can we call a method inside a MFC Application.
The answer is very simple if you used MFC and COM before.
A CWnd or a COleControlSite object has a InvokeHelper method.
virtual void AFX_CDECL InvokeHelper(
const BYTE* pbParamInfo,
You should look inside MSDN for details... Here I'm going to show you how can you invoke a property or a method.
For getting a field inside a property:
this->GetDlgItem(IDC_ACTIVEXCTRL)->InvokeHelper(propertyId, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&vtResult, NULL);
where propertyId is the ID of the property(the same is for setting a value of a property).
For invoking a method, with one or more than one parameter, you can use:
static BYTE params = VTS_BSTR VTS_BSTR;
unsigned long result = 0;
this->GetDlgItem(IDC_ACTIVEXCTRL)->InvokeHelper(methodId, DISPATCH_METHOD, VT_I4, (void*)&result, params,
where parameter1 and parameter2 are two BSTRs.
Well.. that's about it...