Groups | Blog | Home
all groups > dotnet interop > october 2005 >

dotnet interop : COM Interface's GUID property in .NET



keith
10/26/2005 7:27:33 PM
Hi,

I have a COM interface definition which has a property set like this:

[propget, helpstring("property Prop")] HRESULT Prop([out, retval]
GuidType *pVal);
[propput, helpstring("property Prop")] HRESULT Prop([in] GuidType
newVal);

Where 'GuidType' is a typedef of GUID.

I wish to implement this as a .NET class and have done so successfuly
with other properties of the interface that are not GUIDs. But the
above GUID property gives the following message:

error CS0536: 'YourLibrary.YourClass' does not implement interface
member 'COMLib.COMInterface.Prop'. 'YourLibrary.YourClass.Prop' is
either static, not public, or has the wrong return type.

Obviously it's the return type that the compiler is having difficulty
with.

In the .NET class definition I have this:

public Guid Prop
{
get {return m_Prop;}
set {m_Prop = value;}
}

also

public COMLib.GuidType Prop
{
get {return m_Prop;}
set {m_Prop = value;}
}

but both result in this error. What return type am I supposed to use
here?

Sorry for the long post, but i'm totally stuck here.
Thanks in advance,

Keith
Phil Wilson
10/28/2005 7:56:00 AM
I suspect your client doesn't know what a Guid is because it's not one of
the standard COM types that can be marshaled without a custom type library.
Does it work if you use a string instead?
--
Phil Wilson
[Microsoft MVP-Windows Installer]
Definitive Guide to Windows Installer
http://apress.com/book/bookDisplay.html?bID=280

[quoted text, click to view]

keith
11/4/2005 7:55:28 AM
:(, You're right. I just looked it up. I'm so surprised that it's not a
standard type!

Thanks, I'll have to change them to strings and then I'm certain it'll
work.

Keith.

[quoted text, click to view]
AddThis Social Bookmark Button