Using a Custom ActiveX Control in MFC
The ActiveX is a container with a well-determined functionality.
Everybody has heard or seen an ActiveX control. They are everywhere. You could see them in everyday programs, in your office suite or when you are browsing the Internet. An ActiveX can be a media player, a button or a picture. It can simulate custom components (e.g. electrical) or it can be a text editor. You could even see a ActiveX that implement a Web browser.
An ActiveX cannot although execute himself. Therefore you will need a program who can instantiate and play the ActiveX. From his birth the ActiveX is responsible for his own actions. But of course he is capable to communicate with the mainframe that created him. The communication takes place using methods. The ActiveX have one interface on witch the application can Invoke methods that produce the execution of a function at ActiveX level.
While you’re reading this, for sure, it came on your mind: “Why writing a ActiveX? Why not writing common classes?”
The main idea about developing ActiveX controls is that after the inner code is linked and compiled the result is language independent, it can be called and instantiated in many applications without recompiling the last ones. Another issues is that after writing some ActiveX controls and developing an application who plays them, the whole programming part is over, the developing of the project concentrates now on scripting and configurations.
The ActiveX is a powerful object that can realize from simple thing like computing a+b to entering the backdoor of your system and finding all your passwords. ActiveX technology it became mature over the years and is capable to do things easily with a consistent support and no other stuff. You can write an ActiveX control that can be loaded in a Web Browser, or be tested in ActiveX Control Test Container or you could write an application that use custom ActiveX controls.
This article is presenting one issue that its not always have been in the spotlight: creating an application that uses custom ActiveX controls.
Creating the application:
First of all we need to create an application that use MFC. So, to read this article more easily, we’ll choose MFC AppWizard (exe):

I will name the application “Evol”. Next I will choose “Single Document” with “Document/View architecture support”. I have chosen “Single Document” to develop more easily the application.
No support for database.
In the step 3 I will include Container support and ActiveX Controls.
Attachments
Project Files Demo Files