Using an ActiveX control without a form/dialog/window in C++, VS 2008
- by younevertell
an ActiveX control generated by Visual Basic 6, very old stuff, it has a couple of methods and one event.
now I have to use the control in C++, visual studio 2008, but I don't like to generate a form/dialog/window as constainer. I add some MFC class From ActiveX Control. Now the wrap class has all the methods defined in the ActiveX control.
I definitely need add event handler to take care of the event fired by ActiveX control. With a form/dialgue/window, it could be done by below BEGIN_EVENTSINK_MAP ON_EVENT.
My questions are
1. how to add the event handler without a form/dialgue/window. Is this impossible?
2. Could I manually add constructor in the ActiveX control wrap class, so I could use new operator to get an instance on the heap?
Thanks
Add the Event Sinks Map near the start of the definition (.cpp) file. The BEGIN_EVENTSINK_MAP macro takes the container's Class name, then the base class name as parameters. The container's class name is used again in the AFX_EVENTSINK_MAP macro and the ON_EVENT macro.