RE: Preventing aggregation in a .NET class
From: Robert Simpson (RobertSimpson_at_discussions.microsoft.com)
Date: 10/28/04
- Next message: Rob Maushardt: "RE: "Class doesn't support Automation" error"
- Previous message: Robert Simpson: "Re: Preventing aggregation in a .NET class"
- In reply to: Robert Simpson: "Preventing aggregation in a .NET class"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 28 Oct 2004 10:25:01 -0700
AH HA! I finally got it!
The trick was to use an interface with a property (as you had suggested) but
instead of returning the object or late-binding invoke to get the object, the
trick is to wrap the object in an ObjectHandle() class and unwrap it on the
receiving side.
Alternatively, I was able to return any MarshalByRef object that then in
turn exposed a property which returned the actual object I was trying to get
in the first place.
"Robert Simpson" wrote:
> Is there any way to mark a .NET interop class as non-aggregatable? My .NET
> classes are being instantiated as aggegatable objects by 3rd party COM
> objects, and when they're passed around to my other .NET objects they're
> being passed as __ComObject because the Marshaler can't figure out what to do
> with them. When they're instantiated without an outer unknown, they work
> fine. (using VS.NET 2003/2005)
>
> Help!
>
- Next message: Rob Maushardt: "RE: "Class doesn't support Automation" error"
- Previous message: Robert Simpson: "Re: Preventing aggregation in a .NET class"
- In reply to: Robert Simpson: "Preventing aggregation in a .NET class"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|