Copyright © 2013-2014 MultiMedia Soft

Adding the control to a MFC project developed through Visual Studio 2005 or higher

Previous pageReturn to chapter overviewNext page

Find below required steps:

 

Open the project you are working on
Open the dialog box that will host the control
Right click the dialog box area and select "Insert ActiveX control..." from the context menu

 

 

Within the installed ActiveX components find the component named "Active MIDI DJ Console Control" as displayed below

 

 

Pressing the "OK" button will bring you again to your project working area and the design-time representation of the ActiveX control will appear as seen below

 

 

After the insertion you can resize and reposition the control by dragging its handles as needed
You can now start developing your code around the control as described inside the How to use the control in your projects section

 

 

 

 

Important note about wrappers usage

 

The use of ActiveX controls within projects developed using Visual C++ 2003 (or higher) and MFC creates particular issues users must be aware of: as seen for Visual C++ 6.0, ActiveX controls require wrapper classes in order to be used in this environment.

 

Usually these wrapper classes should be generated automatically by the development environment through a dedicated wizard but, due to some unclear policy inside the newer versions of Visual Studio, wrapper classes will result incomplete when dealing with ActiveX controls that, in order to maintain backward compatibility, alternates identifiers of properties and methods. For this reason our control comes with its already generated C++ wrapper classes, installed by the setup package inside the "wrappers\cpp.net" directory (by default the complete path should be "C:\Program Files\Active MIDI DJ Console\wrappers\cpp.net").

 

This issue implies to perform some manual action when creating a variable associated to the control:

 

Insert an instance of Active MIDI DJ Console, as specified above, inside the container dialog box
Copy the following wrapper files into your project directory:

 

ActiveDjConsole.cpp and ActiveDjConsole.h

mididevices.cpp and mididevices.h

mididjconsole.cpp and mididjconsole.h

midivirtualkeyboard.cpp and midivirtualkeyboard.h

 

Add the just mentioned wrapper files to your project.
Open the header file of the dialog box class (supposing that our application's name will be TestApp the header file will be named TestAppDlg.h)
Insert the following includes:

 

#include "ActiveDjConsole.h"

#include "mididevices.h"

#include "mididjconsole.h"

#include "midivirtualkeyboard.h"

 

Inside the CTestAppDlg class, declare a variable of type CActiveDjConsole that will implement the control in your code:

 

CActiveDjConsole      m_djConsole;

 

Open the source file of the dialog class TestAppDlg.cpp
Search the CTestAppDlg::DoDataExchange override function and insert the following code (here we assume that the development environment will assign the identifier IDC_ACTIVEDJCONSOLECTRL1 to the control):

 

DDX_Control(pDX, IDC_ACTIVEDJCONSOLECTRL1, m_djConsole);

 

Just for testing purposes, search the CTestAppDlg::OnInitDialog handler function and insert the following code:

 

m_djConsole.Init ((long) GetSafeHwnd ());

m_djConsole.AboutBox ();

 

Now compile and run the project: you should see the control's about box displayed before showing the main dialog box of the application.