A
asnowfall
I want to send a COM object that is created on C# side, pass it to C+
+, through a different COM object's method(that is implemented on C++
side). Problem is this RCW for this method says Object, while
GetComIDispatchForObject( return InPtr. Can I solve this without
manually changing the RCW?
Essentially.
Method([in] IDispatch* pd, [in] IVab* pV); //C++
side
becomes
Method( Object pd, Object pV); //RCW side
If my question is still not clear, please read further. I have exposed
a .NET object(say CVab ) as COM object. I am able to create this COM
object, in C++, using CoCreateInstance(). The next step is, I want to
create CVab inside C# code and pass it to C++, through a different COM
object's method(that is implemented on C++ side).
a) C++ side
------------------
ICPPcom
{
Method([in] IDispatch* pd, [in] IVab* pV);
}
CPPcom::Method( IDispatch* pd, IVab* pV)
{
//I am trying both, do not know which one is going to succeed
//Method1
pV->callingNET();
//method2
pd->QI(IID_IVab, &pIVab)
pIVab->callingNET();
}
2) C# side
-----------------
ComVisible[...]
Guid[....]
CVab : IVab
{
public void callingNET()
{
}
};
main()
{
//Create COM object, ICPPcom first and pass CVab to it.
CCPPCom objCpp = new CCPPCom ()
CVab obj1 = new CVab();
objCpp.Method( obj1.GetComIDispatchForObject() ,
obj1.GetComInterfaceForObject() );
//Here RCW says Method( Object, Object); but
GetComXXXXXForObject() returns IntPtr.
How do I workout this difference, without changing RCW
manually???
}
Thanks
Ramesh
+, through a different COM object's method(that is implemented on C++
side). Problem is this RCW for this method says Object, while
GetComIDispatchForObject( return InPtr. Can I solve this without
manually changing the RCW?
Essentially.
Method([in] IDispatch* pd, [in] IVab* pV); //C++
side
becomes
Method( Object pd, Object pV); //RCW side
If my question is still not clear, please read further. I have exposed
a .NET object(say CVab ) as COM object. I am able to create this COM
object, in C++, using CoCreateInstance(). The next step is, I want to
create CVab inside C# code and pass it to C++, through a different COM
object's method(that is implemented on C++ side).
a) C++ side
------------------
ICPPcom
{
Method([in] IDispatch* pd, [in] IVab* pV);
}
CPPcom::Method( IDispatch* pd, IVab* pV)
{
//I am trying both, do not know which one is going to succeed
//Method1
pV->callingNET();
//method2
pd->QI(IID_IVab, &pIVab)
pIVab->callingNET();
}
2) C# side
-----------------
ComVisible[...]
Guid[....]
CVab : IVab
{
public void callingNET()
{
}
};
main()
{
//Create COM object, ICPPcom first and pass CVab to it.
CCPPCom objCpp = new CCPPCom ()
CVab obj1 = new CVab();
objCpp.Method( obj1.GetComIDispatchForObject() ,
obj1.GetComInterfaceForObject() );
//Here RCW says Method( Object, Object); but
GetComXXXXXForObject() returns IntPtr.
How do I workout this difference, without changing RCW
manually???
}
Thanks
Ramesh