L
lightdoll
hello everyone.
i have created a com+ made by C#.
The COM+ is singleton.
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
[Guid("9b7384f1-7fd3-444f-acd9-0551ae878caf")]
public interface IOpenInterface
{
bool K_SetEventId(string strSourceId, string strEventId);
int test();
}
[JustInTimeActivation]
[ObjectPooling(Enabled = true, MinPoolSize = 1, MaxPoolSize = 1,
CreationTimeout = 5000)]
[Guid("6d1bcaf4-1d35-44c5-b7cb-7431550ee9c0")]
[ProgId("EasyEda.OpenInterface")]
[ComVisible(true)]
public sealed class IOpenComponent : ServicedComponent, IOpenInterface
{
public IOpenComponent() { }
public int test()
{
System.Diagnostics.Debugger.Break();
return 10;
}
public bool K_SetEventId(string strSourceId, string strEventId)
{
System.Diagnostics.Debugger.Break();
return CEdaInterface.edaInstance.K_SetEventId(strSourceId,
strEventId);
}
}
i called the test function from dll made by c++.
it's ok.
but i called the other function from dll made by c++.
but a error was happened.
CoInitialize(NULL);
HRESULT hr = CoCreateInstance(CLSID_IOpenComponent ,
NULL, CLSCTX_LOCAL_SERVER,
IID_IOpenInterface ,
reinterpret_cast<void**>(&gIOpenInterface));
if(FAILED(hr))
{
OutputDebugString("The Interface failed");
return FALSE;
}
printf("%d\n", gIOpenInterface->test());==> it's ok.
_bstr_t bstr = ::SysAllocString(L"TEST");
gIOpenInterface->K_SetEventId(bstr, bstr);==> The error was happened.
i tried to solve this problem many times..but i can't...
anyone help me solve this problem.
best regards.
i have created a com+ made by C#.
The COM+ is singleton.
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
[Guid("9b7384f1-7fd3-444f-acd9-0551ae878caf")]
public interface IOpenInterface
{
bool K_SetEventId(string strSourceId, string strEventId);
int test();
}
[JustInTimeActivation]
[ObjectPooling(Enabled = true, MinPoolSize = 1, MaxPoolSize = 1,
CreationTimeout = 5000)]
[Guid("6d1bcaf4-1d35-44c5-b7cb-7431550ee9c0")]
[ProgId("EasyEda.OpenInterface")]
[ComVisible(true)]
public sealed class IOpenComponent : ServicedComponent, IOpenInterface
{
public IOpenComponent() { }
public int test()
{
System.Diagnostics.Debugger.Break();
return 10;
}
public bool K_SetEventId(string strSourceId, string strEventId)
{
System.Diagnostics.Debugger.Break();
return CEdaInterface.edaInstance.K_SetEventId(strSourceId,
strEventId);
}
}
i called the test function from dll made by c++.
it's ok.
but i called the other function from dll made by c++.
but a error was happened.
CoInitialize(NULL);
HRESULT hr = CoCreateInstance(CLSID_IOpenComponent ,
NULL, CLSCTX_LOCAL_SERVER,
IID_IOpenInterface ,
reinterpret_cast<void**>(&gIOpenInterface));
if(FAILED(hr))
{
OutputDebugString("The Interface failed");
return FALSE;
}
printf("%d\n", gIOpenInterface->test());==> it's ok.
_bstr_t bstr = ::SysAllocString(L"TEST");
gIOpenInterface->K_SetEventId(bstr, bstr);==> The error was happened.
i tried to solve this problem many times..but i can't...
anyone help me solve this problem.
best regards.