I am writing an application using C# and WinForms. I have an ActiveX control provided by a third party. I drag the ActiveX control to a form, and get an instance of the class (call it "Widget") that the control implements.
Now I need to pass an interface pointer, IWidget, from C# into legacy C++ code. I plan to put the C++ code in a dll and call it from C# using P/Invoke. The problem is I don't know how to provide the IWidget definition to the C++ code. The original authors of the C++ code had header files (say widget.h), so they could #include widget.h, and declare an IWidget pointer.
I don't have the .h (and can't get it). I only have the ActiveX. So how can I declare an IWidget pointer in my dll?
My only idea so far is to create an IDL file from the ActiveX dll. Is that a reasonable approach?
Thanks, Mark