Copyright © 2001-2015 MultiMedia Soft

Adding the control to a Visual Studio.NET project

Previous pageReturn to chapter overviewNext page

First of all, if you are developing a Winform based application inside Visual Studio.NET, we strongly suggest you evaluating our .NET native component Audio DJ Studio for .NET

 

That said, here follow the steps required to add this ActiveX control to a .NET project:

 

Open the project you are working on
If not already visible, open the Toolbox of Visual Studio.NET.
Right click the mouse button over the Toolbox surface.
Select the "Add/Remove Items..." menu item (if still using Visual Studio.NET 2002 use the "Customize Toolbox..." menu item); this will open the "Customize Toolbox" dialog box.
Select the "COM components" tab
Between the installed COM components find the component named "Active DJ Studio Control" as displayed below

 

amp3dj_i00005b

 

Pressing the "OK" button will bring you again to your project working area
Once the control has been inserted inside the project, the following icon should appear inside your toolbox

 

amp3dj_i00005c

 

Now you can select the control icon inside the toolbox and drag it into the dialog box under editing; the following icon will appear on the dialog box (note that this icon will be invisible at runtime) and two references to the control will be automatically added to the "References" section of the Project

 

amp3dj_i00005d

 

Note that you can add more than one instance of the control but the total of the allocated players cannot exceed the maximum number available for the purchased edition.
You can now start developing your code around the control as described inside the How to use the control in your projects section

 

 

Using the control inside Microsoft Visual C++.NET with MFC

 

The use of ActiveX controls within projects developed using Visual C++.NET and MFC creates particular issues users must be aware of: as 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 a bug inside Visual C++.NET (2003, 2005 and 2008), 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 DJ Studio\wrappers\cpp.net").

 

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

 

Dragging the control's icon from the Toolbox, insert an instance of Active DJ Studio inside the container dialog box
Copy wrapper files contained inside the "C:\Program Files\Active DJ Studio\wrappers\cpp.net" into your project directory:
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 "amp3dj.h"

 

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

 

CAmp3dj      m_djStudio;

 

In case you should need using any of the available COM objects inside your code, add the related wrapper file; if for example you should need accessing the Spectrum COM object you will have to add the following line of code:

 

#include "Spectrum.h"

 

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_AMP3DJCTRL1 to the control):

 

DDX_Control(pDX, IDC_ACTIVESOUNDAMP3DJCTRL1, m_djStudio);

 

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

 

m_djStudio.InitDJSystem (2, (long) GetSafeHwnd (), 0, 0, 0, 0);

m_djStudio.AboutBox ();

 

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