AAWAVDEV.C
上传用户:bangxh
上传日期:2007-01-31
资源大小:42235k
文件大小:21k
源码类别:

Windows编程

开发平台:

Visual C++

  1. //==========================================================================;
  2. //
  3. //  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  4. //  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  5. //  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  6. //  PURPOSE.
  7. //
  8. //  Copyright (C) 1992 - 1997 Microsoft Corporation.  All Rights Reserved.
  9. //
  10. //--------------------------------------------------------------------------;
  11. //
  12. //  aawavdev.c
  13. //
  14. //  Description:
  15. //      Get and display information on the wave devices installed in the
  16. //      system.
  17. //
  18. //
  19. //==========================================================================;
  20. #include <windows.h>
  21. #include <windowsx.h>
  22. #include <mmsystem.h>
  23. #include <memory.h>
  24. #include <mmreg.h>
  25. #include <msacm.h>
  26. #include "appport.h"
  27. #include "acmapp.h"
  28. #include "debug.h"
  29. //
  30. //  WAVE[IN|OUT]CAPS
  31. //
  32. //
  33. //
  34. PTSTR gaszWaveInOutCapsFormats[32] =
  35. {
  36.     TEXT("8M11"),           // Bit 0    WAVE_FORMAT_1M08
  37.     TEXT("8S11"),           // Bit 1    WAVE_FORMAT_1S08
  38.     TEXT("16M11"),          // Bit 2    WAVE_FORMAT_1M16
  39.     TEXT("16S11"),          // Bit 3    WAVE_FORMAT_1S16
  40.     TEXT("8M22"),           // Bit 4    WAVE_FORMAT_2M08
  41.     TEXT("8S22"),           // Bit 5    WAVE_FORMAT_2S08
  42.     TEXT("16M22"),          // Bit 6    WAVE_FORMAT_2M16
  43.     TEXT("16S22"),          // Bit 7    WAVE_FORMAT_2S16
  44.     TEXT("8M44"),           // Bit 8    WAVE_FORMAT_4M08
  45.     TEXT("8S44"),           // Bit 9    WAVE_FORMAT_4S08
  46.     TEXT("16M44"),          // Bit 10   WAVE_FORMAT_4M16
  47.     TEXT("16S44"),          // Bit 11   WAVE_FORMAT_4S16
  48.     NULL,                   // Bit 12
  49.     NULL,                   // Bit 13
  50.     NULL,                   // Bit 14
  51.     NULL,                   // Bit 15
  52.     NULL,                   // Bit 16
  53.     NULL,                   // Bit 17
  54.     NULL,                   // Bit 18
  55.     NULL,                   // Bit 19
  56.     NULL,                   // Bit 20
  57.     NULL,                   // Bit 21
  58.     NULL,                   // Bit 22
  59.     NULL,                   // Bit 23
  60.     NULL,                   // Bit 24
  61.     NULL,                   // Bit 25
  62.     NULL,                   // Bit 26
  63.     NULL,                   // Bit 27
  64.     NULL,                   // Bit 28
  65.     NULL,                   // Bit 29
  66.     NULL,                   // Bit 30
  67.     NULL                    // Bit 31
  68. };
  69. PTSTR gaszWaveOutCapsSupport[32] =
  70. {
  71.     TEXT("Pitch"),          // Bit 0    WAVECAPS_PITCH
  72.     TEXT("Playback Rate"),  // Bit 1    WAVECAPS_PLAYBACKRATE
  73.     TEXT("Volume"),         // Bit 2    WAVECAPS_VOLUME
  74.     TEXT("L/R Volume"),     // Bit 3    WAVECAPS_LRVOLUME
  75.     TEXT("Sync"),           // Bit 4    WAVECAPS_SYNC
  76.     NULL,                   // Bit 5
  77.     NULL,                   // Bit 6
  78.     NULL,                   // Bit 7
  79.     NULL,                   // Bit 8
  80.     NULL,                   // Bit 9
  81.     NULL,                   // Bit 10
  82.     NULL,                   // Bit 11
  83.     NULL,                   // Bit 12
  84.     NULL,                   // Bit 13
  85.     NULL,                   // Bit 14
  86.     NULL,                   // Bit 15
  87.     NULL,                   // Bit 16
  88.     NULL,                   // Bit 17
  89.     NULL,                   // Bit 18
  90.     NULL,                   // Bit 19
  91.     NULL,                   // Bit 20
  92.     NULL,                   // Bit 21
  93.     NULL,                   // Bit 22
  94.     NULL,                   // Bit 23
  95.     NULL,                   // Bit 24
  96.     NULL,                   // Bit 25
  97.     NULL,                   // Bit 26
  98.     NULL,                   // Bit 27
  99.     NULL,                   // Bit 28
  100.     NULL,                   // Bit 29
  101.     NULL,                   // Bit 30
  102.     NULL                    // Bit 31
  103. };
  104. //==========================================================================;
  105. //
  106. //
  107. //
  108. //
  109. //==========================================================================;
  110. //--------------------------------------------------------------------------;
  111. //  
  112. //  MMRESULT AcmAppWaveInGetDevCaps
  113. //  
  114. //  Description:
  115. //  
  116. //  
  117. //  Arguments:
  118. //      UINT uDevId:
  119. //  
  120. //      LPWAVEINCAPS pwic:
  121. //  
  122. //  Return (MMRESULT):
  123. //  
  124. //  
  125. //--------------------------------------------------------------------------;
  126. MMRESULT FNLOCAL AcmAppWaveInGetDevCaps
  127. (
  128.     UINT                    uDevId,
  129.     LPWAVEINCAPS            pwic
  130. )
  131. {
  132.     MMRESULT            mmr;
  133.     //
  134.     //
  135.     //
  136.     mmr = waveInGetDevCaps(uDevId, pwic, sizeof(*pwic));
  137.     if (MMSYSERR_NOERROR == mmr)
  138.     {
  139.         //
  140.         //  because some people shipped drivers without testing.
  141.         //
  142.         pwic->szPname[SIZEOF(pwic->szPname) - 1] = '';
  143.     }
  144.     else
  145.     {
  146.         _fmemset(pwic, 0, sizeof(*pwic));
  147.         if (MMSYSERR_BADDEVICEID == mmr)
  148.         {
  149.             return (mmr);
  150.         }
  151.         if (WAVE_MAPPER == uDevId)
  152.         {
  153.             lstrcpy(pwic->szPname, TEXT("Default Wave Input Mapper"));
  154.         }
  155.         else
  156.         {
  157.             wsprintf(pwic->szPname, TEXT("Bad Wave Input Device %u"), uDevId);
  158.         }
  159.     }
  160.     return (MMSYSERR_NOERROR);
  161. } // AcmAppWaveInGetDevCaps()
  162. //--------------------------------------------------------------------------;
  163. //  
  164. //  MMRESULT AcmAppWaveOutGetDevCaps
  165. //  
  166. //  Description:
  167. //  
  168. //  
  169. //  Arguments:
  170. //      UINT uDevId:
  171. //  
  172. //      LPWAVEOUTCAPS pwoc:
  173. //  
  174. //  Return (MMRESULT):
  175. //  
  176. //  
  177. //--------------------------------------------------------------------------;
  178. MMRESULT FNLOCAL AcmAppWaveOutGetDevCaps
  179. (
  180.     UINT                    uDevId,
  181.     LPWAVEOUTCAPS           pwoc
  182. )
  183. {
  184.     MMRESULT            mmr;
  185.     //
  186.     //
  187.     //
  188.     mmr = waveOutGetDevCaps(uDevId, pwoc, sizeof(*pwoc));
  189.     if (MMSYSERR_NOERROR == mmr)
  190.     {
  191.         //
  192.         //  because some people shipped drivers without testing.
  193.         //
  194.         pwoc->szPname[SIZEOF(pwoc->szPname) - 1] = '';
  195.     }
  196.     else
  197.     {
  198.         _fmemset(pwoc, 0, sizeof(*pwoc));
  199.         if (MMSYSERR_BADDEVICEID == mmr)
  200.         {
  201.             return (mmr);
  202.         }
  203.         if (WAVE_MAPPER == uDevId)
  204.         {
  205.             lstrcpy(pwoc->szPname, TEXT("Default Wave Output Mapper"));
  206.         }
  207.         else
  208.         {
  209.             wsprintf(pwoc->szPname, TEXT("Bad Wave Output Device %u"), uDevId);
  210.         }
  211.     }
  212.     return (MMSYSERR_NOERROR);
  213. } // AcmAppWaveOutGetDevCaps()
  214. //--------------------------------------------------------------------------;
  215. //  
  216. //  BOOL AcmAppDisplayWaveInDevCaps
  217. //  
  218. //  Description:
  219. //  
  220. //  
  221. //  Arguments:
  222. //      HWND hedit:
  223. //  
  224. //      UINT uDevId:
  225. //  
  226. //      LPWAVEINCAPS pwic:
  227. //  
  228. //  Return (BOOL):
  229. //  
  230. //  
  231. //--------------------------------------------------------------------------;
  232. BOOL FNLOCAL AcmAppDisplayWaveInDevCaps
  233. (
  234.     HWND                    hedit,
  235.     UINT                    uDevId,
  236.     LPWAVEINCAPS            pwic,
  237.     LPWAVEFORMATEX          pwfx
  238. )
  239. {
  240.     static TCHAR        szDisplayTitle[]    = TEXT("[Wave Input Device Capabilities]rn");
  241.     TCHAR               ach[40];
  242.     PTSTR               psz;
  243.     UINT                u;
  244.     UINT                v;
  245.     DWORD               dw;
  246.     SetWindowRedraw(hedit, FALSE);
  247.     MEditPrintF(hedit, NULL);
  248.     MEditPrintF(hedit, szDisplayTitle);
  249.     //
  250.     //
  251.     //
  252.     if (NULL != pwfx)
  253.     {
  254.         TCHAR           szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS];
  255.         TCHAR           szFormat[ACMFORMATDETAILS_FORMAT_CHARS];
  256.         MMRESULT        mmr;
  257.         HWAVEIN         hwi;
  258.         //
  259.         //
  260.         //
  261.         AcmAppGetFormatDescription(pwfx, szFormatTag, szFormat);
  262.         MEditPrintF(hedit, TEXT("%17s: %s"), (LPTSTR)TEXT("Format"), (LPTSTR)szFormatTag);
  263.         MEditPrintF(hedit, TEXT("%17s: %s"), (LPTSTR)TEXT("Attributes"), (LPTSTR)szFormat);
  264.         //
  265.         //
  266.         //
  267.         MEditPrintF(hedit, TEXT("~%17s: "), (LPTSTR)TEXT("Recordable"));
  268.         mmr = waveInOpen(&hwi, uDevId,
  269. #if (WINVER < 0x0400)
  270.                          (LPWAVEFORMAT)pwfx,
  271. #else
  272.                          pwfx,
  273. #endif
  274.                          0L, 0L, 0L);
  275.         if (MMSYSERR_NOERROR == mmr)
  276.         {
  277.             MEditPrintF(hedit, gszYes);
  278.             waveInClose(hwi);
  279.             hwi = NULL;
  280.         }
  281.         else
  282.         {
  283.             AcmAppGetErrorString(mmr, ach);
  284.             MEditPrintF(hedit, TEXT("%s, %s (%u)"), (LPTSTR)gszNo, (LPSTR)ach, mmr);
  285.         }
  286.         //
  287.         //
  288.         //
  289.         MEditPrintF(hedit, TEXT("~%17s: "), (LPTSTR)TEXT("(Query)"));
  290.         mmr = waveInOpen(NULL, uDevId,
  291. #if (WINVER < 0x0400)
  292.                          (LPWAVEFORMAT)pwfx,
  293. #else
  294.                          pwfx,
  295. #endif
  296.                          0L, 0L, WAVE_FORMAT_QUERY);
  297.         if (MMSYSERR_NOERROR == mmr)
  298.         {
  299.             MEditPrintF(hedit, gszYes);
  300.         }
  301.         else
  302.         {
  303.             AcmAppGetErrorString(mmr, ach);
  304.             MEditPrintF(hedit, TEXT("%s, %s (%u)"), (LPTSTR)gszNo, (LPSTR)ach, mmr);
  305.         }
  306.         MEditPrintF(hedit, gszNull);
  307.     }
  308.     //
  309.     //
  310.     //
  311.     MEditPrintF(hedit, TEXT("%17s: %d"), (LPTSTR)TEXT("Device Id"), uDevId);
  312.     MEditPrintF(hedit, TEXT("%17s: %u"), (LPTSTR)TEXT("Manufacturer Id"), pwic->wMid);
  313.     MEditPrintF(hedit, TEXT("%17s: %u"), (LPTSTR)TEXT("Product Id"), pwic->wPid);
  314.     MEditPrintF(hedit, TEXT("%17s: %u.%.02u"), (LPTSTR)TEXT("Driver Version"),
  315.                 (pwic->vDriverVersion >> 8),
  316.                 (pwic->vDriverVersion & 0x00FF));
  317.     MEditPrintF(hedit, TEXT("%17s: '%s'"), (LPTSTR)TEXT("Device Name"), (LPTSTR)pwic->szPname);
  318.     MEditPrintF(hedit, TEXT("%17s: %u"), (LPTSTR)TEXT("Channels"), pwic->wChannels);
  319.     //
  320.     //
  321.     //
  322.     //
  323.     MEditPrintF(hedit, TEXT("%17s: %.08lXh"), (LPTSTR)TEXT("Standard Formats"), pwic->dwFormats);
  324.     for (v = u = 0, dw = pwic->dwFormats; (0L != dw); u++)
  325.     {
  326.         if ((BYTE)dw & (BYTE)1)
  327.         {
  328.             psz = gaszWaveInOutCapsFormats[u];
  329.             if (NULL == psz)
  330.             {
  331.                 wsprintf(ach, TEXT("Unknown%u"), u);
  332.                 psz = ach;
  333.             }
  334.             if (0 == (v % 4))
  335.             {
  336.                 if (v != 0)
  337.                 {
  338.                     MEditPrintF(hedit, gszNull);
  339.                 }
  340.                 MEditPrintF(hedit, TEXT("~%19s%s"), (LPTSTR)gszNull, (LPTSTR)psz);
  341.             }
  342.             else
  343.             {
  344.                 MEditPrintF(hedit, TEXT("~, %s"), (LPTSTR)psz);
  345.             }
  346.             v++;
  347.         }
  348.         dw >>= 1;
  349.     }
  350.     MEditPrintF(hedit, gszNull);
  351.     SetWindowRedraw(hedit, TRUE);
  352.     return (TRUE);
  353. } // AcmAppDisplayWaveInDevCaps()
  354. //--------------------------------------------------------------------------;
  355. //  
  356. //  BOOL AcmAppDisplayWaveOutDevCaps
  357. //  
  358. //  Description:
  359. //  
  360. //  
  361. //  Arguments:
  362. //      HWND hedit:
  363. //  
  364. //      UINT uDevId:
  365. //  
  366. //      LPWAVEOUTCAPS pwoc:
  367. //  
  368. //  Return (BOOL):
  369. //  
  370. //  
  371. //--------------------------------------------------------------------------;
  372. BOOL FNLOCAL AcmAppDisplayWaveOutDevCaps
  373. (
  374.     HWND                    hedit,
  375.     UINT                    uDevId,
  376.     LPWAVEOUTCAPS           pwoc,
  377.     LPWAVEFORMATEX          pwfx
  378. )
  379. {
  380.     static TCHAR    szDisplayTitle[]    = TEXT("[Wave Output Device Capabilities]rn");
  381.     TCHAR           ach[40];
  382.     PTSTR           psz;
  383.     UINT            u;
  384.     UINT            v;
  385.     DWORD           dw;
  386.     SetWindowRedraw(hedit, FALSE);
  387.     //
  388.     //
  389.     //
  390.     MEditPrintF(hedit, NULL);
  391.     MEditPrintF(hedit, szDisplayTitle);
  392.     //
  393.     //
  394.     //
  395.     if (NULL != pwfx)
  396.     {
  397.         TCHAR           szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS];
  398.         TCHAR           szFormat[ACMFORMATDETAILS_FORMAT_CHARS];
  399.         MMRESULT        mmr;
  400.         HWAVEOUT        hwo;
  401.         DWORD           fdwOpen;
  402.         fdwOpen = (0 != (WAVECAPS_SYNC & pwoc->dwSupport)) ? 0L : WAVE_ALLOWSYNC;
  403.         //
  404.         //
  405.         //
  406.         AcmAppGetFormatDescription(pwfx, szFormatTag, szFormat);
  407.         MEditPrintF(hedit, TEXT("%17s: %s"), (LPTSTR)TEXT("Format"), (LPTSTR)szFormatTag);
  408.         MEditPrintF(hedit, TEXT("%17s: %s"), (LPTSTR)TEXT("Attributes"), (LPTSTR)szFormat);
  409.         //
  410.         //
  411.         //
  412.         MEditPrintF(hedit, TEXT("~%17s: "), (LPTSTR)TEXT("Playable"));
  413.         mmr = waveOutOpen(&hwo, uDevId,
  414. #if (WINVER < 0x0400)
  415.                           (LPWAVEFORMAT)pwfx,
  416. #else
  417.                           pwfx,
  418. #endif
  419.                           0L, 0L, fdwOpen);
  420.         if (MMSYSERR_NOERROR == mmr)
  421.         {
  422.             MEditPrintF(hedit, gszYes);
  423.             waveOutClose(hwo);
  424.             hwo = NULL;
  425.         }
  426.         else
  427.         {
  428.             AcmAppGetErrorString(mmr, ach);
  429.             MEditPrintF(hedit, TEXT("%s, %s (%u)"), (LPTSTR)gszNo, (LPSTR)ach, mmr);
  430.         }
  431.         //
  432.         //
  433.         //
  434.         MEditPrintF(hedit, TEXT("~%17s: "), (LPTSTR)TEXT("(Query)"));
  435.         mmr = waveOutOpen(NULL, uDevId,
  436. #if (WINVER < 0x0400)
  437.                           (LPWAVEFORMAT)pwfx,
  438. #else
  439.                           pwfx,
  440. #endif
  441.                           0L, 0L, fdwOpen | WAVE_FORMAT_QUERY);
  442.         if (MMSYSERR_NOERROR == mmr)
  443.         {
  444.             MEditPrintF(hedit, gszYes);
  445.         }
  446.         else
  447.         {
  448.             AcmAppGetErrorString(mmr, ach);
  449.             MEditPrintF(hedit, TEXT("%s, %s (%u)"), (LPTSTR)gszNo, (LPSTR)ach, mmr);
  450.         }
  451.         MEditPrintF(hedit, gszNull);
  452.     }
  453.     MEditPrintF(hedit, TEXT("%17s: %d"), (LPTSTR)TEXT("Device Id"), uDevId);
  454.     MEditPrintF(hedit, TEXT("%17s: %u"), (LPTSTR)TEXT("Manufacturer Id"), pwoc->wMid);
  455.     MEditPrintF(hedit, TEXT("%17s: %u"), (LPTSTR)TEXT("Product Id"), pwoc->wPid);
  456.     MEditPrintF(hedit, TEXT("%17s: %u.%.02u"), (LPTSTR)TEXT("Driver Version"),
  457.                 (pwoc->vDriverVersion >> 8),
  458.                 (pwoc->vDriverVersion & 0x00FF));
  459.     MEditPrintF(hedit, TEXT("%17s: '%s'"), (LPTSTR)TEXT("Device Name"), (LPTSTR)pwoc->szPname);
  460.     MEditPrintF(hedit, TEXT("%17s: %u"), (LPTSTR)TEXT("Channels"), pwoc->wChannels);
  461.     //
  462.     //
  463.     //
  464.     //
  465.     MEditPrintF(hedit, TEXT("%17s: %.08lXh"), (LPTSTR)TEXT("Standard Formats"), pwoc->dwFormats);
  466.     for (v = u = 0, dw = pwoc->dwFormats; (0L != dw); u++)
  467.     {
  468.         if ((BYTE)dw & (BYTE)1)
  469.         {
  470.             psz = gaszWaveInOutCapsFormats[u];
  471.             if (NULL == psz)
  472.             {
  473.                 wsprintf(ach, TEXT("Unknown%u"), u);
  474.                 psz = ach;
  475.             }
  476.             if (0 == (v % 4))
  477.             {
  478.                 if (v != 0)
  479.                 {
  480.                     MEditPrintF(hedit, gszNull);
  481.                 }
  482.                 MEditPrintF(hedit, TEXT("~%19s%s"), (LPTSTR)gszNull, (LPTSTR)psz);
  483.             }
  484.             else
  485.             {
  486.                 MEditPrintF(hedit, TEXT("~, %s"), (LPTSTR)psz);
  487.             }
  488.             v++;
  489.         }
  490.         dw >>= 1;
  491.     }
  492.     MEditPrintF(hedit, gszNull);
  493.     //
  494.     //
  495.     //
  496.     //
  497.     MEditPrintF(hedit, TEXT("%17s: %.08lXh"), (LPTSTR)TEXT("Standard Support"), pwoc->dwSupport);
  498.     for (v = u = 0, dw = pwoc->dwSupport; dw; u++)
  499.     {
  500.         if ((BYTE)dw & (BYTE)1)
  501.         {
  502.             psz = gaszWaveOutCapsSupport[u];
  503.             if (NULL == psz)
  504.             {
  505.                 wsprintf(ach, TEXT("Unknown%u"), u);
  506.                 psz = ach;
  507.             }
  508.             if (0 == (v % 4))
  509.             {
  510.                 if (v != 0)
  511.                 {
  512.                     MEditPrintF(hedit, gszNull);
  513.                 }
  514.                 MEditPrintF(hedit, TEXT("~%19s%s"), (LPTSTR)gszNull, (LPTSTR)psz);
  515.             }
  516.             else
  517.             {
  518.                 MEditPrintF(hedit, TEXT("~, %s"), (LPTSTR)psz);
  519.             }
  520.             v++;
  521.         }
  522.         dw >>= 1;
  523.     }
  524.     MEditPrintF(hedit, gszNull);
  525.     SetWindowRedraw(hedit, TRUE);
  526.     return (TRUE);
  527. } // AcmAppDisplayWaveOutDevCaps()
  528. //--------------------------------------------------------------------------;
  529. //  
  530. //  BOOL AcmAppWaveDeviceDlgProc
  531. //  
  532. //  Description:
  533. //  
  534. //  
  535. //  Arguments:
  536. //      HWND hwnd:
  537. //  
  538. //      UINT uMsg:
  539. //  
  540. //      WPARAM wParam:
  541. //  
  542. //      LPARAM lParam:
  543. //  
  544. //  Return (BOOL):
  545. //  
  546. //  
  547. //--------------------------------------------------------------------------;
  548. BOOL FNEXPORT AcmAppWaveDeviceDlgProc
  549. (
  550.     HWND                    hwnd,
  551.     UINT                    uMsg,
  552.     WPARAM                  wParam,
  553.     LPARAM                  lParam
  554. )
  555. {
  556.     LONG                lDevice;
  557.     BOOL                fInput;
  558.     UINT                uDevId;
  559.     UINT                cWaveDevs;
  560.     UINT                u;
  561.     UINT                uId;
  562.     UINT                uCmd;
  563.     HWND                hcb;
  564.     HWND                hedit;
  565.     HFONT               hfont;
  566.     WAVEINCAPS          wic;
  567.     WAVEOUTCAPS         woc;
  568.     lDevice = GetWindowLong(hwnd, DWL_USER);
  569.     uDevId  = (UINT)(int)(short)LOWORD(lDevice);
  570.     fInput  = (BOOL)HIWORD(lDevice);
  571.     //
  572.     //
  573.     //
  574.     switch (uMsg)
  575.     {
  576.         case WM_INITDIALOG:
  577. //          hfont = GetStockFont(ANSI_FIXED_FONT);
  578.             hfont = ghfontApp;
  579.             hedit = GetDlgItem(hwnd, IDD_AAWAVEDEVICE_EDIT_CAPABILITIES);
  580.             SetWindowFont(hedit, hfont, FALSE);
  581.             uDevId = (UINT)(int)(short)LOWORD(lParam);
  582.             fInput = (BOOL)HIWORD(lParam);
  583.             SetWindowLong(hwnd, DWL_USER, lParam);
  584.             //
  585.             //
  586.             //
  587.             hcb = GetDlgItem(hwnd, IDD_AAWAVEDEVICE_COMBO_DEVICE);
  588.             SetWindowFont(hcb, hfont, FALSE);
  589.             if (fInput)
  590.                 cWaveDevs = waveInGetNumDevs() + 1;
  591.             else
  592.                 cWaveDevs = waveOutGetNumDevs() + 1;
  593.             for (u = (UINT)WAVE_MAPPER; (0 != cWaveDevs); u++, cWaveDevs--)
  594.             {
  595.                 if (fInput)
  596.                 {
  597.                     AcmAppWaveInGetDevCaps(u, &wic);
  598.                     ComboBox_AddString(hcb, wic.szPname);
  599.                 }
  600.                 else
  601.                 {
  602.                     AcmAppWaveOutGetDevCaps(u, &woc);
  603.                     ComboBox_AddString(hcb, woc.szPname);
  604.                 }
  605.                 if (uDevId == u)
  606.                 {
  607.                     hedit = GetDlgItem(hwnd, IDD_AAWAVEDEVICE_EDIT_CAPABILITIES);
  608.                     if (fInput)
  609.                         AcmAppDisplayWaveInDevCaps(hedit, uDevId, &wic, gaafd.pwfx);
  610.                     else
  611.                         AcmAppDisplayWaveOutDevCaps(hedit, uDevId, &woc, gaafd.pwfx);
  612.                 }
  613.             }
  614.             ComboBox_SetCurSel(hcb, uDevId + 1);
  615.             return (TRUE);
  616.         case WM_COMMAND:
  617.             uId = GET_WM_COMMAND_ID(wParam, lParam);
  618.             switch (uId)
  619.             {
  620.                 case IDOK:
  621.                     hcb    = GetDlgItem(hwnd, IDD_AAWAVEDEVICE_COMBO_DEVICE);
  622.                     uDevId = ComboBox_GetCurSel(hcb);
  623.                     if (CB_ERR != uDevId)
  624.                     {
  625.                         EndDialog(hwnd, uDevId - 1);
  626.                         break;
  627.                     }
  628.                     // -- fall through -- //
  629.                     
  630.                 case IDCANCEL:
  631.                     EndDialog(hwnd, uDevId);
  632.                     break;
  633.                     
  634.                 case IDD_AAWAVEDEVICE_COMBO_DEVICE:
  635.                     uCmd = GET_WM_COMMAND_CMD(wParam, lParam);
  636.                     hcb  = GET_WM_COMMAND_HWND(wParam, lParam);
  637.                     switch (uCmd)
  638.                     {
  639.                         case CBN_SELCHANGE:
  640.                             uDevId = ComboBox_GetCurSel(hcb);
  641.                             if (CB_ERR == uDevId)
  642.                                 break;
  643.                             uDevId--;
  644.                             hedit = GetDlgItem(hwnd, IDD_AAWAVEDEVICE_EDIT_CAPABILITIES);
  645.                             if (fInput)
  646.                             {
  647.                                 AcmAppWaveInGetDevCaps(uDevId, &wic);
  648.                                 AcmAppDisplayWaveInDevCaps(hedit, uDevId, &wic, gaafd.pwfx);
  649.                             }
  650.                             else
  651.                             {
  652.                                 AcmAppWaveOutGetDevCaps(uDevId, &woc);
  653.                                 AcmAppDisplayWaveOutDevCaps(hedit, uDevId, &woc, gaafd.pwfx);
  654.                             }
  655.                             break;
  656.                     }
  657.             }
  658.             return (TRUE);
  659.     }
  660.     return (FALSE);
  661. } // AcmAppWaveDeviceDlgProc()