|
Producing a Dialog Box for Selecting a Specific Type of Format
You might want an application to allow the user to select a format from a
restricted list of formats in a dialog box. Restrictions might limit the number of
channels, the sampling rate, the waveform-audio format tag, or the number of
bits per sample. In all of these cases, you can generate the list by using the acmFormatChoose function, setting the fdwEnum and pwfxEnum members of the ACMFORMATCHOOSE structure. The following example illustrates this process.
MMRESULT mmr;
ACMFORMATCHOOSE afc;
WAVEFORMATEX wfxSelection;
WAVEFORMATEX wfxEnum;
// Initialize the ACMFORMATCHOOSE members.
memset(&afc, 0, sizeof(afc));
afc.cbStruct = sizeof(afc);
afc.fdwStyle = 0L; // no special style flags
afc.hwndOwner = hwnd; // hwnd of parent window
afc.pwfx = &wfxSelection; // wfx to receive selection
afc.cbwfx = sizeof(wfxSelection);
afc.pszTitle = TEXT("16 Bit PCM Selection");
// Request that all 16-bit PCM formats be displayed for the user
// to select from.
memset(&wfxEnum, 0, sizeof(wfxEnum));
wfxEnum.wFormatTag = WAVE_FORMAT_PCM;
wfxEnum.wBitsPerSample = 16;
afc.fdwEnum = ACM_FORMATENUMF_WFORMATTAG |
ACM_FORMATENUMF_WBITSPERSAMPLE;
afc.pwfxEnum = &wfxEnum;
mmr = acmFormatChoose(&afc);
if ((MMSYSERR_NOERROR != mmr) && (ACMERR_CANCELED != mmr))
{
// There was a fatal error in bringing up the list
// dialog box (probably invalid input parameters).
}
Related Links
Software for Delphi and C++ Builder developers
Software for Visual Studio .NET developers
Software for Visual Basic 6 developers
Delphi Tips&Tricks
MegaDetailed.NET
TMS Scripter Studio Pro components for Delphi/C++Builder
More Online Helps
Win32 Programmer's Reference (win32.hlp)
OLE Programmer's Reference (ole.hlp)
Microsoft Windows Pen API Programmer's Reference (penapi.hlp)
Microsoft Windows Sockets 2 Reference (sock2.hlp)
Microsoft Windows Telephony API (TAPI) Programmer's Reference (tapi.hlp)
Unix Manual Pages
|