Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Sep 10, 2010 02:42 PM by pythfr
Member
2 Points
26 Posts
Jul 06, 2010 10:33 AM|LINK
Hi,
Can somebody tell me how to subscribe to .net event from the COM through interoperability?
namespace EventSource { [Guid("A66356CF-7408-4bf5-B02E-17158FE30DA3")] [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] public interface IBugEvents { [DispId(1)] void Hungry(); [DispId(2)] void Found(string item); } [ComSourceInterfaces(typeof(IBugEvents))] public class Bug { public delegate void HungryEventHandler(); public delegate void FoundEventHandler(string item); public event HungryEventHandler Hungry; public event FoundEventHandler Found; } }
Can somebody tell me how to Subscribe to the Hungry and Found events from the COM?If possible help me with COM Code.
Jul 12, 2010 04:48 AM|LINK
Help me on subscribing to .net events from COM environment.
Help me with some COM Code.
1 Post
Sep 10, 2010 02:42 PM|LINK
I had the same problem. You must fire the events; actually you just declare them.
namespace EventSource { [Guid("A66356CF-7408-4bf5-B02E-17158FE30DA3")] [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] public interface IBugEvents { [DispId(1)] void Hungry(); [DispId(2)] void Found(string item); } [ComSourceInterfaces(typeof(IBugEvents))] public class Bug { public delegate void HungryEventHandler(); public delegate void FoundEventHandler(string item); public event HungryEventHandler Hungry; public event FoundEventHandler Found; public void OnHungry() { if(Hungry != null) { Hungry(); } } public void OnFound( string item) { if(Found != null) { Found(item); } } } }
Here are some interesting reference:
- http://www.softinsight.com/DotNetAndCOM.pdf
- COM and .NET Interoperability by Andrew Troelsen Apress Ed
Bye
.NET/COM interoperability delegate
shanenarri
Member
2 Points
26 Posts
Subscribing to .Net event from COM
Jul 06, 2010 10:33 AM|LINK
Hi,
Can somebody tell me how to subscribe to .net event from the COM through interoperability?
namespace EventSource { [Guid("A66356CF-7408-4bf5-B02E-17158FE30DA3")] [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] public interface IBugEvents { [DispId(1)] void Hungry(); [DispId(2)] void Found(string item); } [ComSourceInterfaces(typeof(IBugEvents))] public class Bug { public delegate void HungryEventHandler(); public delegate void FoundEventHandler(string item); public event HungryEventHandler Hungry; public event FoundEventHandler Found; } }Can somebody tell me how to Subscribe to the Hungry and Found events from the COM?If possible help me with COM Code.
shanenarri
Member
2 Points
26 Posts
Re: Subscribing to .Net event from COM
Jul 12, 2010 04:48 AM|LINK
Help me on subscribing to .net events from COM environment.
Help me with some COM Code.
pythfr
Member
2 Points
1 Post
Re: Subscribing to .Net event from COM
Sep 10, 2010 02:42 PM|LINK
Hi,
I had the same problem. You must fire the events; actually you just declare them.
namespace EventSource { [Guid("A66356CF-7408-4bf5-B02E-17158FE30DA3")] [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] public interface IBugEvents { [DispId(1)] void Hungry(); [DispId(2)] void Found(string item); } [ComSourceInterfaces(typeof(IBugEvents))] public class Bug { public delegate void HungryEventHandler(); public delegate void FoundEventHandler(string item); public event HungryEventHandler Hungry; public event FoundEventHandler Found; public void OnHungry() { if(Hungry != null) { Hungry(); } } public void OnFound( string item) { if(Found != null) { Found(item); } } } }
Here are some interesting reference:
- http://www.softinsight.com/DotNetAndCOM.pdf
- COM and .NET Interoperability by Andrew Troelsen Apress Ed
Bye
.NET/COM interoperability delegate