Hi,
I am trying to use an ActiveX Control in a C# class library project. The ActiveX is an open source project that I found from net. I want to use this in a web application, but I don't want to expose any code. So I am trying to create a class library. I am raising the events as follows..
Code:
private CtConectorXClass ctiConnecter = new CtConectorXClass();
public CTIOperations()
{
ctiConnecter.OnACSOpenStreamConf += new ICtConectorXEvents_OnACSOpenStreamConfEventHandler(objCTI_OnACSOpenStreamConf);
ctiConnecter.OnACSCloseStreamConf += new ICtConectorXEvents_OnACSCloseStreamConfEventHandler(objCTI_OnACSCloseStreamConf);
}
private void objCTI_OnACSOpenStreamConf(int invokeId, string apiVersion, string libVersion, string tsrvVersion, string drvVersion)
{
//Code
}
private void objCTI_OnACSCloseStreamConf(int invokeId)
{
//Code
}
public bool OpenStream()
{
int retCode = ctiConnecter.OpenStream(/*arguments*/);
if (retCode < 0)
return false;
else
return true;
}
public bool CloseStream()
{
int retCode = ctiConnecter.CloseStream();
if (retCode < 0)
return false;
else
return true;
}
When I call the class library methods, from a ASP.Net application, the events are not getting raised.
When I referenced the OCX to a windows application, the events are getting raised
And if I refer the OCX directly in a web application, the events are getting raised. In the DLL, it is giving a COM Exception. The methods returns success values but in the Constructor, when the new delegate is created, its throwing a COM Exception.
Code:
Exception from HRESULT: 0x80040202
System.Runtime.InteropServices.COMException (0x80040202): Exception from HRESULT: 0x80040202
at System.Runtime.InteropServices.ComTypes.IConnectionPoint.Advise(Object pUnkSink, Int32& pdwCookie)
at CtConectorXControl.ICtConectorXEvents_EventProvider.add_OnACSOpenStreamConf(ICtConectorXEvents_OnACSOpenStreamConfEventHandler )
at CtConectorXControl.CtConectorXClass.add_OnACSOpenStreamConf(ICtConectorXEvents_OnACSOpenStreamConfEventHandler )
Only in the DLL, I cannot raise the events. Can anybody tell whether I am doing any mistake or the OCX may have some problems. Any help is highly appreciated..
Thanks
Sree