|
How to use Mnemonic Constants |
![]() ![]()
|
The use of Mnemonic Constants improves the readability of your code. This version of the control implements a new internal design to expose these public enumerated types. You will see them in the drop downs on property sheets and in Microsoft's Intellisense feature.
The only environment where this is not the case is Microsoft Visual C++ environment (due to the manner in which the environment communicates with the control).
The following is the full list of enumerated types with their associated properties:
The following examples, under different development environments, show how to use Mnemonic Constants in your code. These examples assume that one instance of the control, named AudioSoundRecorder1, exists on a form or dialog box. The purpose of this sample code is to check if the recorder is currently ripping a CD track.
Microsoft Visual C++ (4.0, 5.0, 6.0 and .NET) Microsoft Visual Basic 5 and 6
Microsoft Visual C++ (4.0, 5.0, 6.0 and .NET)
Because of the different behaviour of these environments, you need to include the header file AdjMmsEngDef.h in order to use predefined Mnemonic Constants: This module can be found inside the product Include directory (default C:\Program Files\Active Sound Recorder\include).
You can test in the recorder is currently ripping a CD track using the following line of code:
if (AudioSoundRecorder1.GetStatus () == RECORD_STATUS_CD_RIPPING) // do something ..... else // do something else .....
The GetStatus method is defined by the control wrapper class CActiveSoundRecorder contained inside the ActiveSoundRecorder.cpp and ActiveSoundRecorder.h files: these wrapper files are automatically generated when you insert the control inside your project. So, in order to access this function, you will have to insert the following line of code somewhere in your code.
#include "ActiveSoundRecorder.h"
The mnemonic constant RECORD_STATUS_CD_RIPPING can be found inside the AdjMmsEngDef.h module file. So, in order to access this value, you will have to insert the following line of code somewhere in your code.
#include "AdjMmsEngDef.h"
Microsoft Visual Basic 5 and 6
In this environment you can use that IntelliSense features that make it easy to assign the intended value to the method parameter. After typing the code... If AudioSoundRecorder1.Status press the "=" key on your keyboard. IntelliSense displays the listbox of the possible values that can used to check the player status:
Select the SOUND_PAUSED value to complete the line of code as follows: If ActiveSoundRecorder1.Status = RECORD_STATUS_CD_RIPPING Then ' do something ..... Else ' do something else ..... End If
|