I have implemented a COM server in C # that has a vb6 client.
When my events are triggered, the handlers are always zero - it seems that the vb6 application never subscribes to my events.
The vb6 application is an existing third-party application and does not appear to report errors.
Normal methods work fine with COM client -> server.
Is there anything I can do to debug what is happening? Or why my events do not work?
Here is a quick code snippet of my code:
[ComVisible(true), Guid(Constants.CLASS_IID), ProgId(Constants.PROG_ID), ClassInterface(ClassInterfaceType.None), ComSourceInterfaces(typeof(IMyServiceEvents))] public class MyClass : Control, IMyService, IMyServiceEvents { [DispId(1)] public event MyEventHandler MyEvent;
If I try an existing ocx file that I am trying to replace / implement using my C # com server, the events work as usual. It is also written in vb6, so something on my C # server should be wrong.
I also want to add that I tried all 3 parameters for ClassInterfaceType and got the same results - although I had to re-register my COM server for every attempt.
Looking at my generated IDL, it looks correct to me, and everything seems very similar to the original IDL, which I am trying to recreate, I can publish if I need to.
UPDATE: Well, I pulled out the old Visual Studio 6 and made a VB6 application to test my C # COM server, and it worked fine.
So, I took the free vb6 decompiler, which could output the decompiled code to the vb6 project and run it on a third-party application that I want to download to my COM server, and saw that it was not working.
I noticed that their application uses my COM server as a control from the designer, and my test program simply declared a member variable as WithEvents. Is something going on behind the scenes with a designer who breaks this? How can I make my COM server compatible with ActiveX? I also notice that VB6 ide will not allow me to add my C # com server to the toolbar as a control.