Jon,
Thanks for your reply. Here is a code snippet. It is not complete but it is
small.
IJDPosition, iLogicalDistPort are COM interfaces defined in VC++ idl files.
DPosoition is COM class ( an ATL object ).
AutoMath.IJDPosition pos = null;
pos = new AutoMath.DPositionClass();
iLogicalDistPort.SetCenterLocation((NozzleEntities.IJDPosition)pos); //This
throws Specified cast in not valid exception.
Why cast is needed :
The iLogicalDistPort is in defined in the idl file of
NozzleEntities VC++ project. Following is the idl file:
import "AutoMath.idl";
interface IJLogicalDistPort : IDispatch
{
[id(2), helpstring("method GetCenterLocation")] HRESULT
GetCenterLocation([out,retval] IJDPosition ** ppPosition);
[id(4), helpstring("method SetCenterLocation")] HRESULT
SetCenterLocation([in] IJDPosition * pPostion);
};
library NozzleEntities
{
coclass DistribPorts
{
[default] interface IDispatch;
interface IJLogicalDistPort;
};
}
Since the object is in the type library of NozzleEntities, the method is
expecting NozzleEntities.IJDPosition as argument.
I can only create AutoMath.DPositionClass(), since that is where my
DPosition class is implemented.
I hope the scenario is clear. If not I can provide more details. Basically
I am creating an unmanaged object and calling a method on it in managed code.
My main question is, this used to work in v1.0. I haven't make any changes
except moving to v1.1. Now I get the exception. Is there any known problem
or known solution for this problem.
Thanks,
Raj