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:
Enumerated type |
Corresponding properties or parameters |
enumWanErrorCodes |
LastError property |
enumWaveformTypes |
nWaveformType parameter of the BitmapViewSaveToFile and GetMinMaxPeakLevelsForRange methods |
enumTrackerCursorModes |
nCursorMode parameter of the SetTrackerCursors method |
enumAnalyzerResolutions |
nResolution field of the WANALYZER_GENERAL_SETTINGS data structure |
enumWaveformStereoModes |
nStereoVisualizationMode field of the WANALYZER_WAVEFORM_SETTINGS and WSCROLLER_SETTINGS data structures and nWaveformStereoMode parameter of the BitmapViewDrawToHdc method |
enumVolumeScales |
nAmplitudeScale field of the WANALYZER_RULERS_SETTINGS data structure |
enumMouseActions |
nAction parameter of the WaveAnalyzerMouseNotification event |
enumWaveAnalyzerRectangles |
nIdRectangle parameter of the GetRectangle method |
enumGraphicFormats |
nFormat parameter of the BitmapViewSaveToFile method |
enumCommonDialogInfo |
nInfo parameter of the CommonDialogGetInfoFromLastOpen and CommonDialogGetInfoFromLastSave methods. |
enumHorizontalLineHeadlineType |
nHeadlineType parameter of the GraphicItemHorizontalLineAdd and GraphicItemHorizontalLineParamsSet methods |
enumHorizontalLineChannel |
nChannel parameter of the GraphicItemHorizontalLineAdd, GraphicItemHorizontalLineParamsSet methods and nChannel field of the WANALYZER_HORIZONTAL_LINE data structure |
enumGraphicItemType |
nType parameter of the GraphicItemTypeGet, GraphicItemsTypeShow and GraphicItemUniqueIdGet methods |
enumGraphicItemMaskValues |
nGraphicItemsMask parameter of the GraphicItemsMouseMoveEnable and BitmapViewGraphicItemsMaskSet methods and nGraphicItemsMask field of the WANALYZER_SCROLLBARS_SETTINGS and WSCROLLER_SETTINGS data structures |
enumWaveformLineDashStyles |
Some field of the WANALYZER_GENERAL_SETTINGS, WANALYZER_VERTICAL_LINE, WANALYZER_HORIZONTAL_LINE and WSCROLLER_SETTINGS data structures |
enumLineCaps |
Some field of the WANALYZER_GENERAL_SETTINGS, WANALYZER_VERTICAL_LINE, WANALYZER_HORIZONTAL_LINE and WSCROLLER_SETTINGS data structures |
enumLineDashCaps |
Some field of the WANALYZER_GENERAL_SETTINGS, WANALYZER_VERTICAL_LINE, WANALYZER_HORIZONTAL_LINE and WSCROLLER_SETTINGS data structures |
enumBuddyAlignment |
nAlignment field of the WANALYZER_BUDDY_PICTURE and WANALYZER_BUDDY_TEXT data structures |
enumMouseButtons |
nButton parameter of the WaveAnalyzerGraphicItemClick and WaveAnalyzerGraphicItemDblClick events |
enumWaveformSelectionMode |
nSelectionMode field of the WANALYZER_WAVEFORM_SETTINGS data structure |
enumTranspGlassType |
nTransparentGlassType field of the WANALYZER_WAVEFORM_SETTINGS and WANALYZER_SCROLLBARS_SETTINGS data structures |
enumWaveScrollbarType |
nType field of the WANALYZER_SCROLLBARS_SETTINGS data structure |
enumScrollbarWaveVisibleRangeType |
nVisibleRangeType field of the WANALYZER_SCROLLBARS_SETTINGS data structure |
enumWaveScrollerAutoUpdate |
nUpdateSpeed field of the WSCROLLER_SETTINGS data structure |
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 WavMmsEngDef.h in order to use predefined Mnemonic Constants: This module can be found inside the product Include directory (default \Program Files\MultiMedia Soft\Active Waveform Analyzer\include).
You can test the last error code using the following line of code:
if (ActiveWaveformAnalyzer1.GetLastError () != ERR_WAN_NOERROR)
// do something
.....
else
// do something else
.....
The GetLastError method is defined by the control wrapper class CActiveWaveformAnalyzer contained inside the ActiveWaveformAnalyzer.cpp and ActiveWaveformAnalyzer.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 "ActiveWaveformAnalyzer.h"
The mnemonic constant ERR_WAN_NOERROR can be found inside the WavMmsEngDef.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 "WavMmsEngDef.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 ActiveWaveformAnalyzer1.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_WAN_NOERROR value to complete the line of code as follows:
If ActiveWaveformAnalyzer1.LastError = ERR_WAN_NOERROR Then
' do something
.....
Else
' do something else
.....
End If