Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add MFC ActiveX control to an existing activex project

In visual studio 2008 I can create an MFC activex project and it presents a wizard to create a single activex control. I now want to create new controls within this project.

I can't find any way to do this.

like image 576
David Avatar asked Jan 28 '10 01:01

David


People also ask

How do I add ActiveX controls?

Add an ActiveX control On the Developer tab, in the Controls group, click Insert, and then under ActiveX Controls, select a control, or click More Controls to view all the available ActiveX controls, and then select a control. Click the worksheet location where you want the ActiveX control to appear.

How do I use ActiveX control in MFC application?

To create an MFC ActiveX Control using the MFC ActiveX Control Wizard. Follow the instructions in the help topic Creating an MFC Application but choose MFC ActiveX Control from the list of available templates. Define your application settings, control names, and control settings using the MFC ActiveX Control Wizard.


2 Answers

I just found that the templates and scripts to generate the ActiveX control code are located in :

Microsoft Visual Studio 9.0\VC\VCWizards\AppWiz\MFC\Control\

There is probably some way to modify that so that it could add a control to an existing project.

like image 164
Nick Avatar answered Sep 29 '22 00:09

Nick


I couldn't find a way to do it either.

In VC6 you can specify how many ActiveX controls you want in your (new) project. Maybe you can build the project in VC6 and port it to VC2008.

Otherwise, my best guess is that you duplicate the code of your current ActiveX control. Create two "Ctrl" and "PropPage" classes similar to the ones of the current control, then duplicate the headers in the .odl/.idl file. If it's done right, the new control will appear in Class View and you can add methods, properties and events.

like image 22
djeidot Avatar answered Sep 29 '22 00:09

djeidot