|
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 Editor\include).
You can test the last error code using the following line of code:
if (ActiveSoundEditor1.GetLastError () != ERR_NOERROR) // do something ..... else // do something else .....
The GetLastError method is defined by the control wrapper class CActiveSoundEditor contained inside the ActiveSoundEditor.cpp and ActiveSoundEditor.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 "ActiveSoundEditor.h"
The mnemonic constant ERR_NOERROR 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 ActiveSoundEditor1.LastError press the "=" key on your keyboard. IntelliSense displays the listbox of the possible values that can used to check the value of the LastError property:
Select the ERR_NOERROR value to complete the line of code as follows:
If ActiveSoundEditor1.LastError = ERR_NOERROR Then ' do something ..... Else ' do something else ..... End If
|