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 |
enumDjcErrorCodes |
LastError property |
enumBoolean |
Used by several methods |
enumDjcMidiKeyboardOrientations |
MidiVirtualKeyboard.Create method |
enumInfoStringType |
MidiDevices.InfoGet and MidiDevices.InfoGetByUniqueId methods |
enumMidiDevicesConfigChanges |
MidiDevicesConfigChanged event |
enumProfileInfoStringType |
MidiDjConsole.ProfileInfoStringGet and MidiDjConsole.ProfileInfoStringSet methods |
enumProfileItemInfoStringType |
|
enumDjConsoleItemType |
MidiDjConsole.ProfileItemAdd and MidiDjConsole.ProfileItemModify methods |
enumDjcCommonDialogInfo |
CommonDialogGetInfoFromLastOpen and CommonDialogGetInfoFromLastSave methods |
enumInternalProfiles |
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 DjConsEngDef.h in order to use predefined Mnemonic Constants: This module can be found inside the product Include directory (default C:\Program Files\MultiMedia Soft\Active MIDI DJ Console\include).
You can test the last error code using the following line of code:
if (ActiveDjConsole1.GetLastError () != ERR_DJC_NOERROR)
// do something
.....
else
// do something else
.....
The GetLastError method is defined by the control wrapper class CActiveDjConsole contained inside the ActiveDjConsole.cpp and ActiveDjConsole.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 "ActiveDjConsole.h"
The mnemonic constant ERR_DJC_NOERROR can be found inside the DjConsEngDef.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 "DjConsEngDef.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 ActiveDjConsole1.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_DJC_NOERROR value to complete the line of code as follows:
If ActiveDjConsole1.LastError = ERR_DJC_NOERROR Then
' do something
.....
Else
' do something else
.....
End If