Copyright © 2013-2023 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 Waveform Analyzer Control" as displayed below

 

 

Pressing the "OK" button will bring you again to your project working area and the 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 "\Program Files\MultiMedia Soft\Active Waveform Analyzer\wrappers\cpp.net").

 

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

 

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

 

ActiveWaveformAnalyzer.cpp and ActiveWaveformAnalyzer.h

WaveformScrollerWan.cpp and WaveformScrollerWan.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 "ActiveWaveformAnalyzer.h"

#include "WaveformScrollerWan.h"

 

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

 

CActiveWaveformAnalyzer      m_waveform;

 

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

 

DDX_Control(pDX, IDC_ACTIVEWAVEFORMANCTRL1, m_waveform);

 

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

 

m_waveform.InitWaveformAnalyzer ((long) GetSafeHwnd ());

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