Anthony,
You can't (and in most cases, shouldn't) define the delegate type for
the event ^IN^ the interface. Rather, just declare it in the same assembly,
and COM interop should pick it up just fine when creating the interop
library.
As for exporting your event for COM interop, check out the section of
MSDN titled "Exported Member Conversion", located at (watch for line wrap):
http://msdn2.microsoft.com/en-us/lib...versionanchor3
Basically, you have to define your event interface to implement in COM
to expose through connection points. However, you can't apply the
ComSourceInterfaces attribute to the interface, you have to apply it to the
class that implements the interface exposing the events.
You don't have to use COM interop in order to use the .NET component in
MFC. You could compile with /CLR, but it might give you overhead you don't
want. You could even create a shim in another MFC dll project which would
interact with .NET, and then reference that.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Anthony Yott" <an*********@hotmail.com> wrote in message
news:35**********************************@microsof t.com...
Nicholas,
I think the big question (for me) is how to define the delegte type for
the
event in the interface so that it is availble to COM clients; otherwise
I'm
not sure how the COM client can subscribe to the event if it doesn't know
the
event target type.
--
Anthony Yott
"Nicholas Paldino [.NET/C# MVP]" wrote:
Anthony,
You mean like this:
public interface IMyInterface
{
public event EventHandler MyEvent;
}
That should give you what you want.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Anthony Yott" <an*********@hotmail.com> wrote in message
news:3B**********************************@microsof t.com... > Anyone have an example of defining a custom event (i.e custom delegate)
> in
> an
> interface?
>
> --
> Anthony Yott