Hi.
I have a C# application that is in need of fetching a C++ class pointer held within a COM object and pass that through to another COM object to populate an equivilent C++ class pointer.
ie:
COM class One creates a class Apple.
COM class Two needs to use COM Class one's instance of Apple.
However, C# application is only link between them.
I have created the ref/out methods on the COM object to pass out the Apple class pointer. Conversely, the other COM object has a method to accept by reference an object.
The trick is what object??
this is the class that sends and needs the pointer
STDMETHODIMP CLogger::get_lo gClassPtr(LONG ** pVal)
{
*pVal = (LONG*)&pLog;
return S_OK;
}
STDMETHODIMP CLogger::putref _logClassPtr(LO NG * newVal)
{
fCreatedInterna lly = false;
pLog = (CCQLog *)newVal;
return S_OK;
}
this is the link between them
ILogger pLog;
pLog = new CLoggerClass();
ICLIWrapper pDB;
pDB = new CCLIWrapperClas s();
pDB.setLogClass = pLog.get_logCla ssPtr();
(I'm a c++ person, not a c# person ;) )
Eric
I have a C# application that is in need of fetching a C++ class pointer held within a COM object and pass that through to another COM object to populate an equivilent C++ class pointer.
ie:
COM class One creates a class Apple.
COM class Two needs to use COM Class one's instance of Apple.
However, C# application is only link between them.
I have created the ref/out methods on the COM object to pass out the Apple class pointer. Conversely, the other COM object has a method to accept by reference an object.
The trick is what object??
this is the class that sends and needs the pointer
STDMETHODIMP CLogger::get_lo gClassPtr(LONG ** pVal)
{
*pVal = (LONG*)&pLog;
return S_OK;
}
STDMETHODIMP CLogger::putref _logClassPtr(LO NG * newVal)
{
fCreatedInterna lly = false;
pLog = (CCQLog *)newVal;
return S_OK;
}
this is the link between them
ILogger pLog;
pLog = new CLoggerClass();
ICLIWrapper pDB;
pDB = new CCLIWrapperClas s();
pDB.setLogClass = pLog.get_logCla ssPtr();
(I'm a c++ person, not a c# person ;) )
Eric