F
Fredo
I've never used C# to create COM servers before and I'm not really sure what
I'm doing wrong. I read something about versioning problems when using
InterfaceIsDual. I thought I could fix this by supplying the DispIDs. I have
the following interface, for example:
[Guid("B7A755CC-809B-412f-BCFE-C47F0084DDFB")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsDual)]
public interface IIdentity
{
[DispId(100)]
void Initialize(byte[] idData);
[DispId(101)]
IIdentity DistanceTo(IIdentity otherID);
[DispId(102)]
int CompareTo(IIdentity otherID);
[DispId(103)]
int RawDataLen
{
get;
}
[DispId(104)]
ulong[] RawData
{
get;
}
[DispId(105)]
int GetBit(int bit);
[DispId(106)]
void SetBit(int bit, int value);
}
}
But when I go into OLE/COM Object Viewer, I see the following for the
dispinterface:
dispinterface _Identity {
properties:
methods:
[id(00000000), propget,
custom(54FC8F55-38DE-4703-9C4E-250351302B1C, 1)]
BSTR ToString();
[id(0x60020001)]
VARIANT_BOOL Equals([in] VARIANT obj);
[id(0x60020002)]
long GetHashCode();
[id(0x60020003)]
_Type* GetType();
[id(0x60020004)]
void Initialize([in] SAFEARRAY(unsigned char) idData);
[id(0x60020005)]
IIdentity* DistanceTo([in] IIdentity* otherID);
[id(0x60020006)]
long CompareTo([in] IIdentity* otherID);
[id(0x60020007), propget]
long RawDataLen();
[id(0x60020008), propget]
SAFEARRAY(uint64) RawData();
[id(0x60020009)]
long GetBit([in] long bit);
[id(0x6002000a)]
void SetBit(
[in] long bit,
[in] long value);
[id(0x6002000b), propget]
SAFEARRAY(unsigned char) ByteArray();
[id(0x6002000c), propget]
SAFEARRAY(uint64) _id();
[id(0x6002000c), propput]
void _id([in] SAFEARRAY(uint64) rhs);
};
Why isn't it using the IDs I'm supplying?
Thanks.
I'm doing wrong. I read something about versioning problems when using
InterfaceIsDual. I thought I could fix this by supplying the DispIDs. I have
the following interface, for example:
[Guid("B7A755CC-809B-412f-BCFE-C47F0084DDFB")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsDual)]
public interface IIdentity
{
[DispId(100)]
void Initialize(byte[] idData);
[DispId(101)]
IIdentity DistanceTo(IIdentity otherID);
[DispId(102)]
int CompareTo(IIdentity otherID);
[DispId(103)]
int RawDataLen
{
get;
}
[DispId(104)]
ulong[] RawData
{
get;
}
[DispId(105)]
int GetBit(int bit);
[DispId(106)]
void SetBit(int bit, int value);
}
}
But when I go into OLE/COM Object Viewer, I see the following for the
dispinterface:
dispinterface _Identity {
properties:
methods:
[id(00000000), propget,
custom(54FC8F55-38DE-4703-9C4E-250351302B1C, 1)]
BSTR ToString();
[id(0x60020001)]
VARIANT_BOOL Equals([in] VARIANT obj);
[id(0x60020002)]
long GetHashCode();
[id(0x60020003)]
_Type* GetType();
[id(0x60020004)]
void Initialize([in] SAFEARRAY(unsigned char) idData);
[id(0x60020005)]
IIdentity* DistanceTo([in] IIdentity* otherID);
[id(0x60020006)]
long CompareTo([in] IIdentity* otherID);
[id(0x60020007), propget]
long RawDataLen();
[id(0x60020008), propget]
SAFEARRAY(uint64) RawData();
[id(0x60020009)]
long GetBit([in] long bit);
[id(0x6002000a)]
void SetBit(
[in] long bit,
[in] long value);
[id(0x6002000b), propget]
SAFEARRAY(unsigned char) ByteArray();
[id(0x6002000c), propget]
SAFEARRAY(uint64) _id();
[id(0x6002000c), propput]
void _id([in] SAFEARRAY(uint64) rhs);
};
Why isn't it using the IDs I'm supplying?
Thanks.