Re: Extending a CoClass
You can't do that because you are changing the vtable layout
of IMPWaypoint. You have to create another interface
IMPWaypoint2. And you can't continue to provide the original
IMPWaypoint interface any longer. Shortly - what you want is
impossible. Your trouble starts with your intent of providing
dual interfaces. Had you eliminated that need, you would have
your object implement independent interfaces instead of cascading
them in your current hierarchy thus extending any one interface
won't affect any other interfaces.
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@mvps.org
MVP VC FAQ: http://vcfaq.mvps.org
=====================================
"Tuckers" <tuckers@work> wrote in message
news:321F6314-363A-41DA-BFAC-C7837F727857@microsoft.com...
Hi,
I have a DLL developed in ATL using visual C++. The IDL looks something
like
interface IMPGeoPoint : IDispatch{
[propget, id(1), helpstring("")] HRESULT Latitude([out, retval] DOUBLE*
pVal);
};
interface IMPRoutePoint : IMPGeoPoint{
[id(2), helpstring("")] HRESULT ID([out, retval] LONG* pVal);
};
interface IMPWaypoint : IMPRoutePoint{
[propget, id(3), helpstring("")] HRESULT Identifier([out, retval] BSTR*
pVal);
};
coclass MPRoutePoint
{
[default] interface IMPRoutePoint;
interface IMPGeoPoint;
};
coclass MPWaypoint
{
[default] interface IMPWaypoint;
interface IMPRoutePoint;
interface IMPGeoPoint;
};
I now need to extend IMPRoutePoint so I need to add an additional
interface
i.e.
interface IMPRoutePoint2 : IMPRoutePoint{
[id(4), helpstring("")] HRESULT Z([out, retval] LONG* pVal);
};
and the other interfaces will look like
interface IMPWaypoint : IMPRoutePoint2{
...
};
and the coclasses will look like
coclass MPRoutePoint
{
[default] interface IMPRoutePoint2;
interface IMPRoutePoint;
interface IMPGeoPoint;
};
coclass MPWaypoint
{
[default] interface IMPWaypoint;
interface IMPRoutePoint; // Do I need this as IMPRoutePoint2 inherits
from IMPRoutePoint
interface IMPRoutePoint2;
interface IMPGeoPoint;
};
Is this the correct way to proceed? I guess I have to make sure that the
ids
don't clash and that I do not change any exitsing ones.
Cheers
in advance
Tuckers