Copyright © 2008-2023 MultiMedia Soft

Adding the control to a Visual Studio.NET project

Previous pageReturn to chapter overviewNext page

Find below required steps:

 

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 "Choose items..." menu item (if still using Visual Studio.NET 2003 use the "Add/Remove Items..." menu item); this will open the "Choose Toolbox Items" dialog box.
Select the "COM components" tab
Between the installed COM components find the component named "Active Sound Recorder ActiveX Control" as displayed below

 

asoed_i00009e

 

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

 

asoed_i00009f

 

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

 

asoed_i0000a0

 

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 "\Program files\MultiMedia Soft\Active Sound Editor\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 Sound Editor inside the container dialog box

Copy the following wrapper files into your project directory:

ActiveSoundEditor.cpp and ActiveSoundEditor.h

WaveformAnalyzer.cpp and WaveformAnalyzer.h

Effects.cpp and Effects.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 "ActiveSoundEditor.h"

#include "WaveformAnalyzer.h"

#include "Effects.h"

 

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

 

CActiveSoundEditor      m_editor;

 

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

 

DDX_Control(pDX, IDC_ACTIVESOUNDEDITORCTRL1, m_editor);

 

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

 

m_editor.InitEditor ((long) GetSafeHwnd ());

m_editor.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.