Really pulling my hair out with this one...
I have a C# project with an interface defined as:
/* Externally Accessible API */
[InterfaceType(ComInter
I was defining the interface using the delegate instead of the event:
/* Externally Accesssible Event API */
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface ISerialEvent
{
[DispId(5)]
void DataEvent();
}
should be
/* Externally Accesssible Event API */
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface ISerialEvent
{
[DispId(5)]
void dEvent();
}
Look at this article here.
Specifically it looks like you missing a declaration that looks something like this.
[Guid("9E5E5FB2-219D-4ee7-AB27-E4DBED8E123E"),
ClassInterface(ClassInterfaceType.None),
ComSourceInterfaces(typeof(DBCOM_Events))]
public class DBCOM_Class : DBCOM_Interface
{
You have this part
// // Events interface Database_COMObjectEvents
[Guid("47C976E0-C208-4740-AC42-41212D3C34F0"),
InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface DBCOM_Events
{
}
But without the second the vtable and typelib of the COM object doesn't have the Event Maps needed to work with VB6 (or other COM Consumers).
You can use the Google search terms "com event" c# and get a bunch of other good results.