Groups | Blog | Home
all groups > dotnet interop > august 2003 >

dotnet interop : problems with CCW


Perecli Manole
8/28/2003 1:28:33 AM
I have several problems with COM Callable Wrappers implementation. Please
answer any of the ones you know:

1. Can't get the ProgIdAttribute("Name") to work. I use
ComClassAttribute(guid,guid,guid) for all my exposed classes so I was
wondering if there is a conflict between these two Attributes. Does
ComClassAttribute cancel ProgIDAttribute?

2. I have read in several places that the ComClassAttribute() simplifies the
setting up of classes to be exposed through COM but no where have I found
what the alternative to this class is. I get the feeling that it is more
involved but maybe can be more flexible.

3. Can't get the ClassInterface(ClassInterfaceType.AutoDispatch) to work as
an alternative to ComClassAttribute(). It is supposed to build an interface
automaticaly based on the members of the class but the class ends up having
no members through COM.

4. I have read in several places that exposed classes derived from other
classes get flattened when exposed to COM but my first hand experience shows
me otherwise. I can only see the members that are in the imediate class. The
ones derived are not visible through COM. What am I doing wrong?

5. The only way I could get the .NET class to be exposed through COM is to
register it with the GAC and make it a strong named assembly but I have read
that this is not necessary. How do I do it without these steps?

6. Is there an article out there that shows best practices for designing CCW
with step by step examples? The MSDN docs are very limited. There are so
many CCW class attributes but they are not explained in depth.

Thanks
Perry

Perecli Manole
8/28/2003 4:26:14 AM
OK, I see. But when I use this instead of the ComClassAttribute the events
do not show.


[quoted text, click to view]

Christian_Fröschlin
8/28/2003 12:19:38 PM
[quoted text, click to view]

All members can be accessed late bound, but don't show up in
browsers. What you want is AutoDual instead of AutoDispatch.
Christian_Fröschlin
8/28/2003 2:16:43 PM
[quoted text, click to view]

You need to explicitely define interfaces like this

<InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)> _
Public Interface TestEventInterface
Sub TestEvent()
End Interface

<ClassInterface(ClassInterfaceType.None), _
ComSourceInterfaces("TestLib.TestEventInterface")> _
Public Class TestClass
Public Event TestEvent()
...
End Class

I don't know if this can be done together with CIT.AutoDual. If you use
CIT.None, you must also explicitely define all interfaces to be exposed
for your class (which must implement them). Only interface members are
then exposed to COM.
Perecli Manole
8/29/2003 11:45:10 PM
If one of my functions return a GUID I noticed that the COM wrapper exposes
this type but how can this be used from the COM side when it doesn't know
what type this is. How can I handle conversions from .NET types to COM
types?

Perry

[quoted text, click to view]

AddThis Social Bookmark Button