home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / graphics / audio / acmapp / aadrvs.c < prev    next >
C/C++ Source or Header  |  1997-10-05  |  41KB  |  1,367 lines

  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. //  aadrvs.c
  12. //
  13. //  Description:
  14. //      Routines to get and display information from ACM drivers.
  15. //
  16. //
  17. //==========================================================================;
  18.  
  19. #include <windows.h>
  20. #include <windowsx.h>
  21. #include <mmsystem.h>
  22. #include <mmreg.h>
  23. #include <msacm.h>
  24. #include <memory.h>
  25. #include "tlb.h"
  26.  
  27. #include "appport.h"
  28. #include "acmapp.h"
  29.  
  30. #include "debug.h"
  31.  
  32.  
  33. TCHAR   gszFormatDriversTitle[] = TEXT("Id\t4!Name\t12!Priority\t3!Support\t6!Full Name");
  34. TCHAR   gszFormatDriversList[]  = TEXT("%.04Xh\t%s\t%lu%s\t%.08lXh\t%s");
  35.  
  36. TCHAR   gszFormatDriverFormatsTitle[] = TEXT("Id\t4!Index\t2!Tag\t2!Support\t5!cbwfx\t2!Format");
  37. TCHAR   gszFormatDriverFormatsList[]  = TEXT("%.04Xh\t%lu\t%lu\t%.08lXh\t%u\t%-s");
  38.  
  39. static HACMDRIVERID     ghadidSelected;
  40. static HACMDRIVER       ghadSelected;
  41.  
  42.  
  43. //--------------------------------------------------------------------------;
  44. //  
  45. //  BOOL AcmAppDisplayDriverDetails
  46. //  
  47. //  Description:
  48. //  
  49. //  
  50. //  Arguments:
  51. //      HWND hedit:
  52. //  
  53. //      HACMDRIVER had:
  54. //  
  55. //  Return (BOOL):
  56. //  
  57. //--------------------------------------------------------------------------;
  58.  
  59. BOOL FNLOCAL AcmAppDisplayDriverDetails
  60. (
  61.     HWND            hedit,
  62.     HACMDRIVERID    hadid
  63. )
  64. {
  65.     static TCHAR    szDisplayTitle[]  = TEXT("[Driver Details]\r\n");
  66.  
  67.     MMRESULT            mmr;
  68.     ACMDRIVERDETAILS    add;
  69.  
  70.     //
  71.     //
  72.     //
  73.     MEditPrintF(hedit, szDisplayTitle);
  74.  
  75.     MEditPrintF(hedit, TEXT("%25s: %.04Xh"), (LPTSTR)TEXT("Driver Identifier Handle"), hadid);
  76.  
  77.     //
  78.     //
  79.     //
  80.     //
  81.     add.cbStruct = sizeof(add);
  82.     mmr = acmDriverDetails(hadid, &add, 0L);
  83.     if (MMSYSERR_NOERROR != mmr)
  84.     {
  85.         //
  86.         //  this should never happen..
  87.         //
  88.         MEditPrintF(hedit, TEXT("%25s: %.08lXh"), (LPTSTR)TEXT("ERROR GETTING DRIVER DETAILS"), mmr);
  89.         return (FALSE);
  90.     }
  91.  
  92.  
  93.     //
  94.     //
  95.     //
  96.     //
  97.     MEditPrintF(hedit, TEXT("%25s: %lu bytes (requested %lu)"),
  98.                    (LPTSTR)TEXT("Size of Driver Details"),
  99.                    add.cbStruct, (DWORD)sizeof(add));
  100.  
  101.     //
  102.     //  this would be bad
  103.     //
  104.     if (add.cbStruct < sizeof(add))
  105.         return (0L);
  106.  
  107.     MEditPrintF(hedit, TEXT("%25s: %.08lXh (%s)"), (LPTSTR)TEXT("FCC Type"),
  108.                    add.fccType,
  109.                    (ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC == add.fccType) ?
  110.                    (LPTSTR)TEXT("'audc'") : (LPTSTR)TEXT("**INVALID**"));
  111.  
  112.     MEditPrintF(hedit, TEXT("%25s: %.08lXh (%s)"), (LPTSTR)TEXT("FCC Compressor"),
  113.                    add.fccComp,
  114.                    (ACMDRIVERDETAILS_FCCCOMP_UNDEFINED == add.fccComp) ?
  115.                    (LPTSTR)TEXT("correct") : (LPTSTR)TEXT("**INVALID**"));
  116.  
  117.     MEditPrintF(hedit, TEXT("%25s: %u"), (LPTSTR)TEXT("Manufacturer Id"), add.wMid);
  118.     MEditPrintF(hedit, TEXT("%25s: %u"), (LPTSTR)TEXT("Product Id"), add.wPid);
  119.  
  120.     MEditPrintF(hedit, TEXT("%25s: %u.%.02u (Build %.03u)"), (LPTSTR)TEXT("ACM Version Required"),
  121.                    HIWORD(add.vdwACM) >> 8,
  122.                    HIWORD(add.vdwACM) & 0x00FF,
  123.                    LOWORD(add.vdwACM));
  124.  
  125.     MEditPrintF(hedit, TEXT("%25s: %u.%.02u (Build %.03u)"), (LPTSTR)TEXT("CODEC Version"),
  126.                    HIWORD(add.vdwDriver) >> 8,
  127.                    HIWORD(add.vdwDriver) & 0x00FF,
  128.                    LOWORD(add.vdwDriver));
  129.  
  130.     MEditPrintF(hedit, TEXT("%25s: %.08lXh"), (LPTSTR)TEXT("Standard Support"), add.fdwSupport);
  131.     MEditPrintF(hedit, TEXT("%25s: %u"), (LPTSTR)TEXT("Count Format Tags"), add.cFormatTags);
  132.     MEditPrintF(hedit, TEXT("%25s: %u"), (LPTSTR)TEXT("Count Filter Tags"), add.cFilterTags);
  133.     MEditPrintF(hedit, TEXT("%25s: %.04Xh"), (LPTSTR)TEXT("Custom Icon Handle"), add.hicon);
  134.     MEditPrintF(hedit, TEXT("%25s: '%s'"), (LPTSTR)TEXT("Short Name"), (LPTSTR)add.szShortName);
  135.     MEditPrintF(hedit, TEXT("%25s: '%s'"), (LPTSTR)TEXT("Long Name"), (LPTSTR)add.szLongName);
  136.     MEditPrintF(hedit, TEXT("%25s: '%s'"), (LPTSTR)TEXT("Copyright"), (LPTSTR)add.szCopyright);
  137.     MEditPrintF(hedit, TEXT("%25s: '%s'"), (LPTSTR)TEXT("Licensing"), (LPTSTR)add.szLicensing);
  138.     MEditPrintF(hedit, TEXT("%25s: '%s'\r\n"), (LPTSTR)TEXT("Features"), (LPTSTR)add.szFeatures);
  139.  
  140.  
  141.     //
  142.     //
  143.     //
  144.     if (0 != (ACMDRIVERDETAILS_SUPPORTF_HARDWARE & add.fdwSupport))
  145.     {
  146.         TCHAR       ach[40];
  147.         DWORD       dw;
  148.  
  149.         mmr = acmMetrics((HACMOBJ)hadid, ACM_METRIC_HARDWARE_WAVE_INPUT, &dw);
  150.         AcmAppGetErrorString(mmr, ach);
  151.         MEditPrintF(hedit, TEXT("%25s: %ld (mmr = %s, [%u])"), (LPTSTR)TEXT("Wave Input Device"), dw, (LPTSTR)ach, mmr);
  152.  
  153.         mmr = acmMetrics((HACMOBJ)hadid, ACM_METRIC_HARDWARE_WAVE_OUTPUT, &dw);
  154.         AcmAppGetErrorString(mmr, ach);
  155.         MEditPrintF(hedit, TEXT("%25s: %ld (mmr = %s, [%u])"), (LPTSTR)TEXT("Wave Output Device"), dw, (LPTSTR)ach, mmr);
  156.     }
  157.  
  158.     return (TRUE);
  159. } // AcmAppDisplayDriverDetails()
  160.  
  161.  
  162. //--------------------------------------------------------------------------;
  163. //  
  164. //  BOOL AcmAppDisplayFormats
  165. //  
  166. //  Description:
  167. //  
  168. //  
  169. //  Arguments:
  170. //      HWND hedit:
  171. //  
  172. //      HACMDRIVER had:
  173. //  
  174. //      ACMFORMATTAGDETAILS paftd:
  175. //  
  176. //  Return (BOOL):
  177. //  
  178. //  
  179. //--------------------------------------------------------------------------;
  180.  
  181. BOOL FNLOCAL AcmAppDisplayFormats
  182. (
  183.     HWND                    hedit,
  184.     HACMDRIVER              had,
  185.     LPACMFORMATTAGDETAILS   paftd
  186. )
  187. {
  188.     MMRESULT            mmr;
  189.     UINT                u;
  190.     ACMFORMATDETAILS    afd;
  191.     PWAVEFORMATEX       pwfx;
  192.  
  193.     if (0 == paftd->cStandardFormats)
  194.         return (TRUE);
  195.  
  196.     pwfx = (PWAVEFORMATEX)LocalAlloc(LPTR, (UINT)paftd->cbFormatSize);
  197.     if (NULL == pwfx)
  198.         return (FALSE);
  199.  
  200.     //
  201.     //
  202.     //
  203.     //
  204.     for (u = 0; u < paftd->cStandardFormats; u++)
  205.     {
  206.         afd.cbStruct        = sizeof(afd);
  207.         afd.dwFormatIndex   = u;
  208.         afd.dwFormatTag     = paftd->dwFormatTag;
  209.         afd.fdwSupport      = 0L;
  210.         afd.pwfx            = pwfx;
  211.         afd.cbwfx           = paftd->cbFormatSize;
  212.         afd.szFormat[0]     = '\0';
  213.  
  214.         mmr = acmFormatDetails(had, &afd, ACM_FORMATDETAILSF_INDEX);
  215.         if (MMSYSERR_NOERROR != mmr)
  216.         {
  217.             //
  218.             //  this should never happen..
  219.             //
  220.             MEditPrintF(hedit, TEXT("%25s: err = %.04Xh"), (LPTSTR)TEXT("ERROR GETTING FORMAT DETAILS"), mmr);
  221.             continue;
  222.         }
  223.  
  224.  
  225.         //
  226.         //  this would be bad
  227.         //
  228.         if (afd.cbStruct < sizeof(afd))
  229.         {
  230.             MEditPrintF(hedit, TEXT("%25s: %lu bytes (requested %lu)"), (LPTSTR)TEXT("Size of Format Details"),
  231.                         afd.cbStruct, (DWORD)sizeof(afd));
  232.             continue;
  233.         }
  234.  
  235.         MEditPrintF(hedit, TEXT("%15s %u: '%s'"), (LPTSTR)TEXT("Format"), u, (LPTSTR)afd.szFormat);
  236.  
  237.     }
  238.  
  239.     LocalFree((HLOCAL)pwfx);
  240.  
  241.     return (TRUE);
  242. } // AcmAppDisplayFormats()
  243.  
  244.  
  245. //--------------------------------------------------------------------------;
  246. //  
  247. //  BOOL AcmAppDisplayDriverTags
  248. //  
  249. //  Description:
  250. //  
  251. //  
  252. //  Arguments:
  253. //      HWND hedit:
  254. //  
  255. //      HACMDRIVER had:
  256. //  
  257. //  Return (BOOL):
  258. //  
  259. //  
  260. //--------------------------------------------------------------------------;
  261.  
  262. BOOL FNLOCAL AcmAppDisplayDriverTags
  263. (
  264.     HWND            hedit,
  265.     HACMDRIVER      had
  266. )
  267. {
  268.     static TCHAR    szDisplayTitle[]      = TEXT("[Driver Tags]\r\n");
  269.     static TCHAR    szDisplayFormatTags[] = TEXT("\r\n[Format Tags]");
  270.     static TCHAR    szDisplayFilterTags[] = TEXT("\r\n[Filter Tags]");
  271.  
  272.     TCHAR               ach[APP_MAX_STRING_CHARS];
  273.     ACMDRIVERDETAILS    add;
  274.     MMRESULT            mmr;
  275.     UINT                u;
  276.     HACMDRIVERID        hadid;
  277.  
  278.     //
  279.     //
  280.     //
  281.     MEditPrintF(hedit, szDisplayTitle);
  282.  
  283.     mmr = acmDriverID((HACMOBJ)had, &hadid, 0L);
  284.     MEditPrintF(hedit, TEXT("%25s: %.04Xh"), (LPTSTR)TEXT("Driver Identifier Handle"), hadid);
  285.     MEditPrintF(hedit, TEXT("%25s: %.04Xh"), (LPTSTR)TEXT("Driver Handle"), had);
  286.  
  287.     //
  288.     //
  289.     //
  290.     //
  291.     add.cbStruct = sizeof(add);
  292.     mmr = acmDriverDetails(hadid, &add, 0L);
  293.     if (MMSYSERR_NOERROR != mmr)
  294.     {
  295.         //
  296.         //  this should never happen..
  297.         //
  298.         MEditPrintF(hedit, TEXT("%25s: %.08lXh"), (LPTSTR)TEXT("ERROR GETTING INFO"), mmr);
  299.         return (FALSE);
  300.     }
  301.  
  302.  
  303.     MEditPrintF(hedit, TEXT("%25s: '%s'"), (LPTSTR)TEXT("Name"), (LPTSTR)add.szShortName);
  304.     MEditPrintF(hedit, TEXT("%25s: %u"), (LPTSTR)TEXT("Count Format Tags"), add.cFormatTags);
  305.     MEditPrintF(hedit, TEXT("%25s: %u"), (LPTSTR)TEXT("Count Filter Tags"), add.cFilterTags);
  306.  
  307.     if (0 != add.cFormatTags)
  308.         MEditPrintF(hedit, szDisplayFormatTags);
  309.  
  310.     for (u = 0; u < add.cFormatTags; u++)
  311.     {
  312.         ACMFORMATTAGDETAILS aftd;
  313.         WAVEFORMATEX        wfx;
  314.  
  315.         MEditPrintF(hedit, TEXT("\r\n%25s: %u"), (LPTSTR)TEXT("Format Tag Index"), u);
  316.  
  317.         _fmemset(&aftd, 0, sizeof(aftd));
  318.  
  319.         aftd.cbStruct         = sizeof(aftd);
  320.         aftd.dwFormatTagIndex = u;
  321.         mmr = acmFormatTagDetails(had, &aftd, ACM_FORMATTAGDETAILSF_INDEX);
  322.         if (MMSYSERR_NOERROR != mmr)
  323.         {
  324.             MEditPrintF(hedit, TEXT("%25s: %.08lXh"), (LPTSTR)TEXT("ERROR GETTING TAGS"), mmr);
  325.             return (FALSE);
  326.         }
  327.  
  328.         MEditPrintF(hedit, TEXT("%25s: %lu bytes (requested %lu)"),
  329.                     (LPTSTR)TEXT("Size of Tag Details"),
  330.                     aftd.cbStruct, (DWORD)sizeof(aftd));
  331.  
  332.         //
  333.         //  this would be bad
  334.         //
  335.         if (aftd.cbStruct < sizeof(aftd))
  336.             continue;
  337.  
  338.         wfx.wFormatTag = LOWORD(aftd.dwFormatTag);
  339.         AcmAppGetFormatDescription(&wfx, ach, NULL);
  340.         MEditPrintF(hedit, TEXT("%25s: [%lu], %s"), (LPTSTR)TEXT("Format Tag"), aftd.dwFormatTag, (LPTSTR)ach);
  341.         MEditPrintF(hedit, TEXT("%25s: %u bytes"), (LPTSTR)TEXT("Format Size (Max)"), aftd.cbFormatSize);
  342.         MEditPrintF(hedit, TEXT("%25s: %.08lXh"), (LPTSTR)TEXT("Standard Support"), aftd.fdwSupport);
  343.         MEditPrintF(hedit, TEXT("%25s: %lu"), (LPTSTR)TEXT("Standard Formats"), aftd.cStandardFormats);
  344.         MEditPrintF(hedit, TEXT("%25s: '%s'"), (LPTSTR)TEXT("Format Tag Name"), (LPTSTR)aftd.szFormatTag);
  345.  
  346.         AcmAppDisplayFormats(hedit, had, &aftd);
  347.     }
  348.  
  349.     if (0 != add.cFilterTags)
  350.         MEditPrintF(hedit, szDisplayFilterTags);
  351.  
  352.     for (u = 0; u < add.cFilterTags; u++)
  353.     {
  354.         ACMFILTERTAGDETAILS aftd;
  355.         WAVEFILTER          wfltr;
  356.  
  357.         MEditPrintF(hedit, TEXT("%25s: %u"), (LPTSTR)TEXT("Filter Tag Index"), u);
  358.  
  359.         _fmemset(&aftd, 0, sizeof(aftd));
  360.  
  361.         aftd.cbStruct         = sizeof(aftd);
  362.         aftd.dwFilterTagIndex = u;
  363.         mmr = acmFilterTagDetails(had, &aftd, ACM_FILTERTAGDETAILSF_INDEX);
  364.         if (MMSYSERR_NOERROR != mmr)
  365.         {
  366.             //
  367.             //
  368.             //
  369.             MEditPrintF(hedit, TEXT("%25s: %.08lXh"), (LPTSTR)TEXT("ERROR GETTING TAGS"), mmr);
  370.  
  371.             return (FALSE);
  372.         }
  373.  
  374.         MEditPrintF(hedit, TEXT("%25s: %lu bytes (requested %lu)"),
  375.                     (LPTSTR)TEXT("Size of Tag Details"),
  376.                     aftd.cbStruct, (DWORD)sizeof(aftd));
  377.  
  378.         //
  379.         //  this would be bad
  380.         //
  381.         if (aftd.cbStruct < sizeof(aftd))
  382.             continue;
  383.  
  384.         wfltr.dwFilterTag = aftd.dwFilterTag;
  385.         AcmAppGetFilterDescription(&wfltr, ach, NULL);
  386.         MEditPrintF(hedit, TEXT("%25s: [%lu], %s"), (LPTSTR)TEXT("Filter Tag"), aftd.dwFilterTag, (LPTSTR)ach);
  387.         MEditPrintF(hedit, TEXT("%25s: %lu bytes"), (LPTSTR)TEXT("Format Size (Max)"), aftd.cbFilterSize);
  388.         MEditPrintF(hedit, TEXT("%25s: %.08lXh"), (LPTSTR)TEXT("Standard Support"), aftd.fdwSupport);
  389.         MEditPrintF(hedit, TEXT("%25s: %lu"), (LPTSTR)TEXT("Standard Filters"), aftd.cStandardFilters);
  390.         MEditPrintF(hedit, TEXT("%25s: '%s'\r\n"), (LPTSTR)TEXT("Filter Tag Name"), (LPTSTR)aftd.szFilterTag);
  391.     }
  392.  
  393.  
  394.     return (TRUE);
  395. } // AcmAppDisplayDriverTags()
  396.  
  397.  
  398. //--------------------------------------------------------------------------;
  399. //  
  400. //  BOOL AcmAppDriverDetailsDlgProc
  401. //  
  402. //  Description:
  403. //  
  404. //  
  405. //  Arguments:
  406. //      HWND hwnd:
  407. //  
  408. //      UINT uMsg:
  409. //  
  410. //      WPARAM wParam:
  411. //  
  412. //      LPARAM lParam:
  413. //  
  414. //  Return (BOOL):
  415. //  
  416. //  
  417. //--------------------------------------------------------------------------;
  418.  
  419. BOOL FNEXPORT AcmAppDriverDetailsDlgProc
  420. (
  421.     HWND                    hwnd,
  422.     UINT                    uMsg,
  423.     WPARAM                  wParam,
  424.     LPARAM                  lParam
  425. )
  426. {
  427.     HACMDRIVERID        hadid;
  428.     HWND                hedit;
  429.     UINT                uId;
  430.  
  431.     switch (uMsg)
  432.     {
  433.         case WM_INITDIALOG:
  434.             hedit = GetDlgItem(hwnd, IDD_AADETAILS_EDIT_DETAILS);
  435.             SetWindowFont(hedit, ghfontApp, FALSE);
  436.  
  437.             //
  438.             //  clear the display
  439.             //
  440.             AppHourGlass(TRUE);
  441.             SetWindowRedraw(hedit, FALSE);
  442.             MEditPrintF(hedit, NULL);
  443.  
  444.             hadid = (HACMDRIVERID)(UINT)lParam;
  445.             if (NULL == hadid)
  446.             {
  447.                 MEditPrintF(hedit, TEXT("\r\n\r\nhmm..."));
  448.             }
  449.             else
  450.             {
  451.                 AcmAppDisplayDriverDetails(hedit, hadid);
  452.             }
  453.  
  454.             Edit_SetSel(hedit, (WPARAM)0, (LPARAM)0);
  455.  
  456.             SetWindowRedraw(hedit, TRUE);
  457.             AppHourGlass(FALSE);
  458.  
  459.             return (TRUE);
  460.  
  461.         case WM_COMMAND:
  462.             uId = GET_WM_COMMAND_ID(wParam, lParam);
  463.  
  464.             if ((IDOK == uId) || (IDCANCEL == uId))
  465.             {
  466.                 EndDialog(hwnd, (IDOK == uId));
  467.             }
  468.             break;
  469.     }
  470.  
  471.     return (FALSE);
  472. } // AcmAppDriverDetailsDlgProc()
  473.  
  474.  
  475. //==========================================================================;
  476. //
  477. //
  478. //
  479. //
  480. //==========================================================================;
  481.  
  482. //--------------------------------------------------------------------------;
  483. //  
  484. //  BOOL AcmAppDriverFormatDetailsDlgProc
  485. //  
  486. //  Description:
  487. //  
  488. //  
  489. //  Arguments:
  490. //      HWND hwnd:
  491. //  
  492. //      UINT uMsg:
  493. //  
  494. //      WPARAM wParam:
  495. //  
  496. //      LPARAM lParam:
  497. //  
  498. //  Return (BOOL):
  499. //  
  500. //  
  501. //--------------------------------------------------------------------------;
  502.  
  503. BOOL FNEXPORT AcmAppDriverFormatDetailsDlgProc
  504. (
  505.     HWND            hwnd,
  506.     UINT            uMsg,
  507.     WPARAM          wParam,
  508.     LPARAM          lParam
  509. )
  510. {
  511.     HACMDRIVERID        hadid;
  512.     HWND                hlb;
  513.     HWND                hedit;
  514.     int                 n;
  515.     UINT                uId;
  516.  
  517.     switch (uMsg)
  518.     {
  519.         case WM_INITDIALOG:
  520.             hlb = GetDlgItem(GetParent(hwnd), IDD_AADRIVERFORMATS_LIST_FORMATS);
  521.             n   = ListBox_GetCurSel(hlb);
  522.             if (LB_ERR == n)
  523.                 return (TRUE);
  524.  
  525.             hadid = (HACMDRIVERID)(UINT)ListBox_GetItemData(hlb, n);
  526.             hedit = GetDlgItem(hwnd, IDD_AADETAILS_EDIT_DETAILS);
  527.             SetWindowFont(hedit, ghfontApp, FALSE);
  528.  
  529.             //
  530.             //  clear the display
  531.             //
  532.             AppHourGlass(TRUE);
  533.             SetWindowRedraw(hedit, FALSE);
  534.             MEditPrintF(hedit, NULL);
  535.  
  536.             MEditPrintF(hedit, TEXT("\r\n\r\nFormat Details!"));
  537.  
  538.             Edit_SetSel(hedit, (WPARAM)0, (LPARAM)0);
  539.  
  540.             SetWindowRedraw(hedit, TRUE);
  541.             AppHourGlass(FALSE);
  542.             return (TRUE);
  543.  
  544.         case WM_COMMAND:
  545.             uId = GET_WM_COMMAND_ID(wParam, lParam);
  546.             if ((IDOK == uId) || (IDCANCEL == uId))
  547.             {
  548.                 EndDialog(hwnd, (IDOK == uId));
  549.             }
  550.             break;
  551.     }
  552.  
  553.     return (FALSE);
  554. } // AcmAppDriverFormatDetailsDlgProc()
  555.  
  556.  
  557. //--------------------------------------------------------------------------;
  558. //  
  559. //  BOOL AcmAppDriverFormatEnumCallback
  560. //  
  561. //  Description:
  562. //  
  563. //  
  564. //  Arguments:
  565. //      HACMDRIVERID hadid:
  566. //  
  567. //      DWORD dwInstance:
  568. //  
  569. //      DWORD fdwSupport:
  570. //  
  571. //  Return (BOOL):
  572. //  
  573. //  
  574. //--------------------------------------------------------------------------;
  575.  
  576. BOOL FNEXPORT AcmAppDriverFormatEnumCallback
  577. (
  578.     HACMDRIVERID        hadid,
  579.     LPACMFORMATDETAILS  pafd,
  580.     DWORD               dwInstance,
  581.     DWORD               fdwSupport
  582. )
  583. {
  584.     TCHAR               ach[APP_MAX_STRING_CHARS];
  585.     HWND                hlb;
  586.     int                 nIndex;
  587.     LPARAM              lParam;
  588.     UINT                cbwfx;
  589.  
  590.     //
  591.     //
  592.     //
  593.     hlb = (HWND)(UINT)dwInstance;
  594.  
  595.     cbwfx = SIZEOF_WAVEFORMATEX(pafd->pwfx);
  596.  
  597.     wsprintf(ach, gszFormatDriverFormatsList,
  598.              hadid,
  599.              pafd->dwFormatIndex,
  600.              pafd->dwFormatTag,
  601.              pafd->fdwSupport,
  602.              cbwfx,
  603.              (LPTSTR)pafd->szFormat);
  604.  
  605.     AcmAppDebugLog(ach);
  606.     AcmAppDebugLog(TEXT("\r\n"));
  607.  
  608.                 
  609.     nIndex = ListBox_AddString(hlb, ach);
  610.     lParam = (LPARAM)(UINT)hadid;
  611.     ListBox_SetItemData(hlb, nIndex, lParam);
  612.  
  613.     //
  614.     //  return TRUE to continue with enumeration
  615.     //
  616.     return (TRUE);
  617. } // AcmAppDriverFormatEnumCallback()
  618.  
  619.  
  620. //--------------------------------------------------------------------------;
  621. //
  622. //  BOOL AcmAppDriverFormatsDlgProc
  623. //
  624. //  Description:
  625. //      This dialog procedure is used to display driver formats.
  626. //
  627. //  Arguments:
  628. //      HWND hwnd: Handle to window.
  629. //
  630. //      UINT uMsg: Message being sent to the window.
  631. //
  632. //      WPARAM wParam: Specific argument to message.
  633. //
  634. //      LPARAM lParam: Specific argument to message.
  635. //
  636. //  Return (BOOL):
  637. //      The return value is specific to the message that was received. For
  638. //      the most part, it is FALSE if this dialog procedure does not handle
  639. //      a message.
  640. //
  641. //
  642. //--------------------------------------------------------------------------;
  643.  
  644. BOOL FNEXPORT AcmAppDriverFormatsDlgProc
  645. (
  646.     HWND                    hwnd,
  647.     UINT                    uMsg,
  648.     WPARAM                  wParam,
  649.     LPARAM                  lParam
  650. )
  651. {
  652.     static PTABBEDLISTBOX   ptlb;
  653.     HWND                    hwndStatic;
  654.     MMRESULT                mmr;
  655.     RECT                    rc;
  656.     PAINTSTRUCT             ps;
  657.     UINT                    uId;
  658.     UINT                    uCode;
  659.  
  660.     HACMDRIVER              had;
  661.     ACMFORMATDETAILS        afd;
  662.     PWAVEFORMATEX           pwfx;
  663.     DWORD                   cbwfx;
  664.  
  665.     switch (uMsg)
  666.     {
  667.         case WM_INITDIALOG:
  668.             hwndStatic = GetDlgItem(hwnd, IDD_AADRIVERFORMATS_STATIC_POSITION);
  669.  
  670.             GetWindowRect(hwndStatic, &rc);
  671.             ScreenToClient(hwnd, (LPPOINT)&rc.left);
  672.             ScreenToClient(hwnd, (LPPOINT)&rc.right);
  673.  
  674.             ShowWindow(hwndStatic, SW_HIDE);
  675.  
  676.             EnableWindow(GetDlgItem(hwnd, IDD_AADRIVERFORMATS_BTN_DETAILS), FALSE);
  677.  
  678.             ptlb = TlbCreate(hwnd, IDD_AADRIVERFORMATS_LIST_FORMATS, &rc);
  679.             if (NULL == ptlb)
  680.                 return (TRUE);
  681.  
  682.             TlbSetFont(ptlb, GetStockFont(SYSTEM_FONT), FALSE);
  683.             TlbSetTitleAndTabs(ptlb, gszFormatDriverFormatsTitle, FALSE);
  684.  
  685.             SetWindowPos(ptlb->hlb, GetDlgItem(hwnd, IDOK), 
  686.                             0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
  687.  
  688.             ListBox_ResetContent(ptlb->hlb);
  689.  
  690.             AcmAppDebugLog(NULL);
  691.  
  692.             had = (HACMDRIVER)(UINT)lParam;
  693.  
  694.             mmr = acmMetrics((HACMOBJ)had, ACM_METRIC_MAX_SIZE_FORMAT, &cbwfx);
  695.             if (MMSYSERR_NOERROR != mmr)
  696.                 return (TRUE);
  697.  
  698.             pwfx = (PWAVEFORMATEX)LocalAlloc(LPTR, (UINT)cbwfx);
  699.             if (NULL == pwfx)
  700.                 return (TRUE);
  701.  
  702.             _fmemset(&afd, 0, sizeof(afd));
  703.  
  704.             afd.cbStruct    = sizeof(afd);
  705.             afd.dwFormatTag = WAVE_FORMAT_UNKNOWN;
  706.             afd.pwfx        = pwfx;
  707.             afd.cbwfx       = cbwfx;
  708.  
  709.             //
  710.             //
  711.             //
  712.             SetWindowRedraw(ptlb->hlb, FALSE);
  713.  
  714.             mmr = acmFormatEnum(had,
  715.                                 &afd,
  716.                                 AcmAppDriverFormatEnumCallback,
  717.                                 (DWORD)(UINT)ptlb->hlb,
  718.                                 0L);
  719.             if (MMSYSERR_NOERROR == mmr)
  720.             {
  721.                 ListBox_SetCurSel(ptlb->hlb, 0);
  722.                 EnableWindow(GetDlgItem(hwnd, IDD_AADRIVERFORMATS_BTN_DETAILS), TRUE);
  723.             }
  724.  
  725.             SetWindowRedraw(ptlb->hlb, TRUE);
  726.             LocalFree((HLOCAL)pwfx);
  727.  
  728.             return (TRUE);
  729.  
  730.         case WM_PAINT:
  731.             if (NULL != ptlb)
  732.             {
  733.                 BeginPaint(hwnd, &ps);
  734.                 TlbPaint(ptlb, hwnd, ps.hdc);
  735.                 EndPaint(hwnd, &ps);
  736.             }
  737.             break;
  738.  
  739.         case WM_COMMAND:
  740.             uId   = GET_WM_COMMAND_ID(wParam, lParam);
  741.             uCode = GET_WM_COMMAND_CMD(wParam, lParam);
  742.             switch (uId)
  743.             {
  744.                 case IDOK:
  745.                 case IDCANCEL:
  746.                     if (NULL != ptlb)
  747.                     {
  748.                         //
  749.                         //  hadidk! don't destroy the listbox window, but
  750.                         //  free all other memory for TLB. the listbox
  751.                         //  window will be destroyed when the dialog is
  752.                         //  destroyed.
  753.                         //
  754.                         ptlb->hlb = NULL;
  755.  
  756.                         TlbDestroy(ptlb);
  757.                         ptlb = NULL;
  758.                     }
  759.  
  760.                     EndDialog(hwnd, (IDOK == uId));
  761.                     break;
  762.  
  763.                 case IDD_AADRIVERFORMATS_BTN_DETAILS:
  764.                     DialogBoxParam(ghinst,
  765.                                    DLG_AADETAILS,
  766.                                    hwnd,
  767.                                    AcmAppDriverFormatDetailsDlgProc,
  768.                                    uId);
  769.                     break;
  770.  
  771.                 case IDD_AADRIVERFORMATS_LIST_FORMATS:
  772.                     switch (uCode)
  773.                     {
  774.                         case LBN_SELCHANGE:
  775.                             break;
  776.  
  777.                         case LBN_DBLCLK:
  778.                             DialogBoxParam(ghinst,
  779.                                            DLG_AADETAILS,
  780.                                            hwnd,
  781.                                            AcmAppDriverFormatDetailsDlgProc,
  782.                                            IDD_AADRIVERFORMATS_BTN_DETAILS);
  783.                             break;
  784.                     }
  785.                     break;
  786.             }
  787.             break;
  788.     }
  789.  
  790.     return (FALSE);
  791. } // AcmAppDriverFormatsDlgProc()
  792.  
  793.  
  794. //==========================================================================;
  795. //
  796. //
  797. //
  798. //
  799. //==========================================================================;
  800.  
  801. //--------------------------------------------------------------------------;
  802. //  
  803. //  BOOL AcmAppDriverEnumCallback
  804. //  
  805. //  Description:
  806. //  
  807. //  
  808. //  Arguments:
  809. //      HACMDRIVERID hadid:
  810. //  
  811. //      DWORD dwInstance:
  812. //  
  813. //      DWORD fdwSupport:
  814. //  
  815. //  Return (BOOL):
  816. //  
  817. //  
  818. //--------------------------------------------------------------------------;
  819.  
  820. BOOL FNEXPORT AcmAppDriverEnumCallback
  821. (
  822.     HACMDRIVERID        hadid,
  823.     DWORD               dwInstance,
  824.     DWORD               fdwSupport
  825. )
  826. {
  827.     static TCHAR    szBogus[]       = TEXT("????");
  828.  
  829.     MMRESULT            mmr;
  830.     TCHAR               ach[APP_MAX_STRING_CHARS];
  831.     HWND                hlb;
  832.     int                 n;
  833.     ACMDRIVERDETAILS    add;
  834.     BOOL                fDisabled;
  835.     DWORD               dwPriority;
  836.  
  837.     //
  838.     //
  839.     //
  840.     hlb = (HWND)(UINT)dwInstance;
  841.  
  842.     add.cbStruct = sizeof(add);
  843.     mmr = acmDriverDetails(hadid, &add, 0L);
  844.     if (MMSYSERR_NOERROR != mmr)
  845.     {
  846.         lstrcpy(add.szShortName, szBogus);
  847.         lstrcpy(add.szLongName,  szBogus);
  848.     }
  849.  
  850.     dwPriority = (DWORD)-1L;
  851.     acmMetrics((HACMOBJ)hadid, ACM_METRIC_DRIVER_PRIORITY, &dwPriority);
  852.  
  853.     fDisabled = (0 != (ACMDRIVERDETAILS_SUPPORTF_DISABLED & fdwSupport));
  854.  
  855.     wsprintf(ach, gszFormatDriversList,
  856.              hadid,
  857.              (LPTSTR)add.szShortName,
  858.              dwPriority,
  859.              fDisabled ? (LPTSTR)TEXT(" (disabled)") : (LPTSTR)gszNull,
  860.              fdwSupport,
  861.              (LPTSTR)add.szLongName);
  862.  
  863.     AcmAppDebugLog(ach);
  864.     AcmAppDebugLog(TEXT("\r\n"));
  865.                 
  866.     n = ListBox_AddString(hlb, ach);
  867.     ListBox_SetItemData(hlb, n, (LPARAM)(UINT)hadid);
  868.  
  869.  
  870.     //
  871.     //  return TRUE to continue with enumeration (FALSE will stop the
  872.     //  enumerator)
  873.     //
  874.     return (TRUE);
  875. } // AcmAppDriverEnumCallback()
  876.  
  877.  
  878. //--------------------------------------------------------------------------;
  879. //  
  880. //  HACMDRIVERID AcmAppGetSelectedDriver
  881. //  
  882. //  Description:
  883. //  
  884. //  
  885. //  Arguments:
  886. //      HWND hwnd:
  887. //  
  888. //  Return (HACMDRIVERID):
  889. //  
  890. //  
  891. //--------------------------------------------------------------------------;
  892.  
  893. HACMDRIVERID FNLOCAL AcmAppGetSelectedDriver
  894. (
  895.     HWND            hwnd
  896. )
  897. {
  898.     HWND            hlb;
  899.     UINT            u;
  900.     HACMDRIVERID    hadid;
  901.  
  902.     hlb = GetDlgItem(hwnd, IDD_AADRIVERS_LIST_DRIVERS);
  903.  
  904.     u = (UINT)ListBox_GetCurSel(hlb);
  905.     if (LB_ERR == u)
  906.     {
  907.         DPF(0, "!AcmAppGetSelectedDriver: apparently there is no selected driver?");
  908.         return (NULL);
  909.     }
  910.  
  911.     hadid = (HACMDRIVERID)(UINT)ListBox_GetItemData(hlb, u);
  912.     if (NULL == hadid)
  913.     {
  914.         DPF(0, "!AcmAppGetSelectedDriver: NULL item data for selected driver!!?");
  915.         return (NULL);
  916.     }
  917.  
  918.     return (hadid);
  919. } // AcmAppGetSelectedDriver()
  920.  
  921.  
  922. //--------------------------------------------------------------------------;
  923. //  
  924. //  BOOL AcmAppDriverSelected
  925. //  
  926. //  Description:
  927. //  
  928. //  
  929. //  Arguments:
  930. //      HWND hwnd:
  931. //  
  932. //  Return (BOOL):
  933. //  
  934. //  
  935. //--------------------------------------------------------------------------;
  936.  
  937. HACMDRIVER FNLOCAL AcmAppDriverSelected
  938. (
  939.     HWND                    hwnd
  940. )
  941. {
  942.     LRESULT             lr;
  943.     MMRESULT            mmr;
  944.     BOOL                f;
  945.     HACMDRIVERID        hadid;
  946.     HACMDRIVER          had;
  947.     DWORD               fdwSupport;
  948.  
  949.     f = FALSE;
  950.  
  951.     //
  952.     //
  953.     //
  954.     if (NULL != ghadSelected)
  955.     {
  956.         mmr = acmDriverClose(ghadSelected, 0L);
  957.         if (MMSYSERR_NOERROR != mmr)
  958.         {
  959.             DPF(0, "!AcmAppDriverSelected: driver %.04Xh failed to close! mmr=%u", ghadSelected, mmr);
  960.         }
  961.  
  962.         ghadSelected = NULL;
  963.     }
  964.  
  965.     had = NULL;
  966.  
  967.     //
  968.     //
  969.     //
  970.     hadid = AcmAppGetSelectedDriver(hwnd);
  971.     if (NULL != hadid)
  972.     {
  973.         mmr = acmMetrics((HACMOBJ)hadid, ACM_METRIC_DRIVER_SUPPORT, &fdwSupport);
  974.         if (MMSYSERR_NOERROR != mmr)
  975.         {
  976.             fdwSupport = ACMDRIVERDETAILS_SUPPORTF_DISABLED;
  977.  
  978.             //
  979.             //  !!! this should NEVER EVER EVER HAPPEN !!!
  980.             //
  981.             DPF(0, "!AcmAppDriverSelected: driver id %.04Xh failed to give support! mmr=%u", hadid, mmr);
  982.         }
  983.  
  984.         if (0 == (ACMDRIVERDETAILS_SUPPORTF_DISABLED & fdwSupport))
  985.         {
  986.             mmr = acmDriverOpen(&had, hadid, 0L);
  987.             if (MMSYSERR_NOERROR != mmr)
  988.             {
  989.                 DPF(0, "!AcmAppDriverSelected: driver id %.04Xh failed to open! mmr=%u", hadid, mmr);
  990.             }
  991.         }
  992.  
  993.         //
  994.         //
  995.         //
  996.         EnableWindow(GetDlgItem(hwnd, IDD_AADRIVERS_BTN_DETAILS), TRUE);
  997.  
  998.         lr = acmDriverMessage((HACMDRIVER)hadid, ACMDM_DRIVER_ABOUT, -1L, 0L);
  999.         f = (MMSYSERR_NOERROR == lr);
  1000.         EnableWindow(GetDlgItem(hwnd, IDD_AADRIVERS_BTN_ABOUT), f);
  1001.  
  1002.         lr = acmDriverMessage((HACMDRIVER)hadid, DRV_QUERYCONFIGURE, 0L, 0L);
  1003.         f = (0L != lr);
  1004.         EnableWindow(GetDlgItem(hwnd, IDD_AADRIVERS_BTN_CONFIG), f);
  1005.     }
  1006.     else
  1007.     {
  1008.         EnableWindow(GetDlgItem(hwnd, IDD_AADRIVERS_BTN_DETAILS), FALSE);
  1009.         EnableWindow(GetDlgItem(hwnd, IDD_AADRIVERS_BTN_ABOUT), FALSE);
  1010.         EnableWindow(GetDlgItem(hwnd, IDD_AADRIVERS_BTN_CONFIG), FALSE);
  1011.     }
  1012.  
  1013.  
  1014.     //
  1015.     //
  1016.     //
  1017.     if (NULL == had)
  1018.     {
  1019.         //
  1020.         //
  1021.         EnableWindow(GetDlgItem(hwnd, IDD_AADRIVERS_BTN_FORMATS), FALSE);
  1022.         EnableWindow(GetDlgItem(hwnd, IDD_AADRIVERS_BTN_FILTERS), FALSE);
  1023.     }
  1024.     else
  1025.     {
  1026.         f = (0 == (ACMDRIVERDETAILS_SUPPORTF_DISABLED & fdwSupport));
  1027.         EnableWindow(GetDlgItem(hwnd, IDD_AADRIVERS_BTN_FORMATS), f);
  1028.  
  1029.         f = (0 != (ACMDRIVERDETAILS_SUPPORTF_FILTER & fdwSupport));
  1030.         EnableWindow(GetDlgItem(hwnd, IDD_AADRIVERS_BTN_FILTERS), f);
  1031.     }
  1032.  
  1033.     //
  1034.     //
  1035.     //
  1036.     ghadidSelected = hadid;
  1037.     ghadSelected   = had;
  1038.  
  1039.     return (had);
  1040. } // AcmAppDriverSelected()
  1041.  
  1042.  
  1043. //--------------------------------------------------------------------------;
  1044. //
  1045. //  BOOL AcmAppDriversDlgProc
  1046. //
  1047. //  Description:
  1048. //      This dialog procedure is used to display ACM driver capabilities.
  1049. //
  1050. //  Arguments:
  1051. //      HWND hwnd: Handle to window.
  1052. //
  1053. //      UINT uMsg: Message being sent to the window.
  1054. //
  1055. //      WPARAM wParam: Specific argument to message.
  1056. //
  1057. //      LPARAM lParam: Specific argument to message.
  1058. //
  1059. //  Return (BOOL):
  1060. //      The return value is specific to the message that was received. For
  1061. //      the most part, it is FALSE if this dialog procedure does not handle
  1062. //      a message.
  1063. //
  1064. //--------------------------------------------------------------------------;
  1065.  
  1066. BOOL FNEXPORT AcmAppDriversDlgProc
  1067. (
  1068.     HWND                    hwnd,
  1069.     UINT                    uMsg,
  1070.     WPARAM                  wParam,
  1071.     LPARAM                  lParam
  1072. )
  1073. {
  1074.     PTABBEDLISTBOX      ptlb;
  1075.     HWND                hstat;
  1076.     MMRESULT            mmr;
  1077.     LRESULT             lr;
  1078.     RECT                rc;
  1079.     PAINTSTRUCT         ps;
  1080.     UINT                uId;
  1081.     UINT                uCode;
  1082.     UINT                u;
  1083.  
  1084.  
  1085.     ptlb = (PTABBEDLISTBOX)(UINT)GetWindowLong(hwnd, DWL_USER);
  1086.  
  1087.     switch (uMsg)
  1088.     {
  1089.         case WM_INITDIALOG:
  1090.             hstat = GetDlgItem(hwnd, IDD_AADRIVERS_STATIC_POSITION);
  1091.  
  1092.             GetWindowRect(hstat, &rc);
  1093.             ScreenToClient(hwnd, (LPPOINT)&rc.left);
  1094.             ScreenToClient(hwnd, (LPPOINT)&rc.right);
  1095.  
  1096.             ShowWindow(hstat, SW_HIDE);
  1097.  
  1098.             ptlb = TlbCreate(hwnd, IDD_AADRIVERS_LIST_DRIVERS, &rc);
  1099.             SetWindowLong(hwnd, DWL_USER, (LONG)(UINT)ptlb);
  1100.             if (NULL == ptlb)
  1101.             {
  1102.                 EndDialog(hwnd, FALSE);
  1103.                 return (TRUE);
  1104.             }
  1105.  
  1106.             //
  1107.             //
  1108.             //
  1109.             TlbSetFont(ptlb, GetStockFont(SYSTEM_FONT), FALSE);
  1110.             TlbSetTitleAndTabs(ptlb, gszFormatDriversTitle, FALSE);
  1111.  
  1112.             SetWindowPos(ptlb->hlb, GetDlgItem(hwnd, IDOK), 
  1113.                             0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
  1114.  
  1115.             SendMessage(hwnd, WM_ACMAPP_ACM_NOTIFY, 0, 0L);
  1116.             return (TRUE);
  1117.  
  1118.  
  1119.         case WM_PAINT:
  1120.             if (NULL != ptlb)
  1121.             {
  1122.                 BeginPaint(hwnd, &ps);
  1123.                 TlbPaint(ptlb, hwnd, ps.hdc);
  1124.                 EndPaint(hwnd, &ps);
  1125.             }
  1126.             break;
  1127.  
  1128.  
  1129.         case WM_ACMAPP_ACM_NOTIFY:
  1130.             u = (UINT)ListBox_GetCurSel(ptlb->hlb);
  1131.             if (LB_ERR == u)
  1132.             {
  1133.                 u = 0;
  1134.             }
  1135.  
  1136.             SetWindowRedraw(ptlb->hlb, FALSE);
  1137.             ListBox_ResetContent(ptlb->hlb);
  1138.  
  1139.             AcmAppDebugLog(NULL);
  1140.  
  1141.             //
  1142.             //
  1143.             //
  1144.             mmr = acmDriverEnum(AcmAppDriverEnumCallback,
  1145.                                 (DWORD)(UINT)ptlb->hlb,
  1146.                                 ACM_DRIVERENUMF_DISABLED);
  1147.             if (MMSYSERR_NOERROR != mmr)
  1148.             {
  1149.                 //
  1150.                 //  this will let us know something is wrong!
  1151.                 //
  1152.                 EnableWindow(GetDlgItem(hwnd, IDOK), FALSE);
  1153.             }
  1154.  
  1155.             ListBox_SetCurSel(ptlb->hlb, u);
  1156.             SetWindowRedraw(ptlb->hlb, TRUE);
  1157.  
  1158.             AcmAppDriverSelected(hwnd);
  1159.             break;
  1160.  
  1161.  
  1162.         case WM_COMMAND:
  1163.             uId   = GET_WM_COMMAND_ID(wParam, lParam);
  1164.             uCode = GET_WM_COMMAND_CMD(wParam, lParam);
  1165.             switch (uId)
  1166.             {
  1167.                 case IDOK:
  1168.                 case IDCANCEL:
  1169.                     if (NULL != ptlb)
  1170.                     {
  1171.                         //
  1172.                         //  hadidk! don't destroy the listbox window, but
  1173.                         //  free all other memory for TLB. the listbox
  1174.                         //  window will be destroyed when the dialog is
  1175.                         //  destroyed.
  1176.                         //
  1177.                         ptlb->hlb = NULL;
  1178.  
  1179.                         TlbDestroy(ptlb);
  1180.                         ptlb = NULL;
  1181.                     }
  1182.  
  1183.                     if (NULL != ghadSelected)
  1184.                     {
  1185.                         acmDriverClose(ghadSelected, 0L);
  1186.                         ghadSelected = NULL;
  1187.                     }
  1188.  
  1189.                     EndDialog(hwnd, (IDOK == uId));
  1190.                     break;
  1191.  
  1192.                 case IDD_AADRIVERS_BTN_DETAILS:
  1193.                     DialogBoxParam(ghinst,
  1194.                                    DLG_AADETAILS,
  1195.                                    hwnd,
  1196.                                    AcmAppDriverDetailsDlgProc,
  1197.                                    (LPARAM)(UINT)ghadidSelected);
  1198.                     break;
  1199.  
  1200.                 case IDD_AADRIVERS_BTN_FORMATS:
  1201.                     if (NULL != ghadSelected)
  1202.                     {
  1203.                         DialogBoxParam(ghinst,
  1204.                                        DLG_AADRIVERFORMATS,
  1205.                                        hwnd,
  1206.                                        AcmAppDriverFormatsDlgProc,
  1207.                                        (LPARAM)(UINT)ghadSelected);
  1208.                     }
  1209.                     break;
  1210.  
  1211.                 case IDD_AADRIVERS_BTN_FILTERS:
  1212. #if 0
  1213.                     if (NULL != ghadSelected)
  1214.                     {
  1215.                         DialogBoxParam(ghinst,
  1216.                                        DLG_AADRIVERFILTERS,
  1217.                                        hwnd,
  1218.                                        AcmAppDriverFiltersDlgProc,
  1219.                                        (LPARAM)(UINT)ghadSelected);
  1220.                     }
  1221. #endif
  1222.                     break;
  1223.  
  1224.  
  1225.                 case IDD_AADRIVERS_BTN_CONFIG:
  1226.                     if (NULL == ghadidSelected)
  1227.                         break;
  1228.  
  1229.                     lr = acmDriverMessage((HACMDRIVER)ghadidSelected,
  1230.                                           DRV_CONFIGURE,
  1231.                                           (LPARAM)(UINT)hwnd,
  1232.                                           0L);
  1233.                     switch (lr)
  1234.                     {
  1235.                         case DRVCNF_CANCEL:
  1236.                             //
  1237.                             //  user canceled the configuration (no
  1238.                             //  configuration information was changed)
  1239.                             //
  1240.                             break;
  1241.  
  1242.                         case DRVCNF_OK:
  1243.                             //
  1244.                             //  user changed AND accepted configuration
  1245.                             //  changes--applications should refresh
  1246.                             //  anything they have for this driver
  1247.                             //
  1248.                             break;
  1249.  
  1250.                         case DRVCNF_RESTART:
  1251.                             //
  1252.                             //  user changed and accepted configuration
  1253.                             //  changes--however, Windows must be
  1254.                             //  restarted for the changes to take 
  1255.                             //  affect.
  1256.                             //
  1257. #pragma message("----AcmAppDriversDlgProc: must do DRVCNF_RESTART!")
  1258.                             break;
  1259.  
  1260.                         default:
  1261.                             DPF(0, "!configure: driver returned bogus value=%lu!", lr);
  1262.                             break;
  1263.                     }
  1264.                     break;
  1265.  
  1266.                 case IDD_AADRIVERS_BTN_ABOUT:
  1267.                     if (NULL != ghadidSelected)
  1268.                     {
  1269.                         //
  1270.                         //  some driver was actually silly enough to provide
  1271.                         //  a custom about box... i'm glad i don't have to
  1272.                         //  port, maintain, and support this driver!
  1273.                         //
  1274.                         lr = acmDriverMessage((HACMDRIVER)ghadidSelected,
  1275.                                               ACMDM_DRIVER_ABOUT,
  1276.                                               (LPARAM)(UINT)hwnd,
  1277.                                               0L);
  1278.                     }
  1279.                     break;
  1280.  
  1281.  
  1282.                 case IDD_AADRIVERS_BTN_ABLE:
  1283.                     if (NULL != ghadidSelected)
  1284.                     {
  1285.                         DWORD       fdwSupport;
  1286.                         DWORD       fdwPriority;
  1287.  
  1288.                         mmr = acmMetrics((HACMOBJ)ghadidSelected,
  1289.                                          ACM_METRIC_DRIVER_SUPPORT,
  1290.                                          &fdwSupport);
  1291.  
  1292.                         if (MMSYSERR_NOERROR != mmr)
  1293.                         {
  1294.                             MessageBeep(0);
  1295.                             break;
  1296.                         }
  1297.  
  1298.                         if (0 == (ACMDRIVERDETAILS_SUPPORTF_DISABLED & fdwSupport))
  1299.                         {
  1300.                             fdwPriority = ACM_DRIVERPRIORITYF_DISABLE;
  1301.                         }
  1302.                         else
  1303.                         {
  1304.                             fdwPriority = ACM_DRIVERPRIORITYF_ENABLE;
  1305.                         }
  1306.  
  1307.                         mmr = acmDriverPriority(ghadidSelected,
  1308.                                                 0L,
  1309.                                                 fdwPriority);
  1310.                         if (MMSYSERR_NOERROR != mmr)
  1311.                         {
  1312.                             MessageBeep(0);
  1313.                             break;
  1314.                         }
  1315.                     }
  1316.                     break;
  1317.  
  1318.  
  1319.                 case IDD_AADRIVERS_BTN_TOTOP:
  1320.                     if (NULL != ghadidSelected)
  1321.                     {
  1322.                         mmr = acmDriverPriority(ghadidSelected, 1, 0L);
  1323.                         if (MMSYSERR_NOERROR != mmr)
  1324.                         {
  1325.                             MessageBeep(0);
  1326.                             break;
  1327.                         }
  1328.                     }
  1329.                     break;
  1330.  
  1331.  
  1332.                 case IDD_AADRIVERS_LIST_DRIVERS:
  1333.                     switch (uCode)
  1334.                     {
  1335.                         case LBN_SELCHANGE:
  1336.                             AcmAppDriverSelected(hwnd);
  1337.                             break;
  1338.  
  1339.                         case LBN_DBLCLK:
  1340.                             if (GetKeyState(VK_CONTROL) < 0)
  1341.                             {
  1342.                                 uId = IDD_AADRIVERS_BTN_ABLE;
  1343.                             }
  1344.                             else if (GetKeyState(VK_SHIFT) < 0)
  1345.                             {
  1346.                                 uId = IDD_AADRIVERS_BTN_TOTOP;
  1347.                             }
  1348.                             else
  1349.                             {
  1350.                                 uId = IDD_AADRIVERS_BTN_DETAILS;
  1351.                             }
  1352.  
  1353.                             FORWARD_WM_COMMAND(hwnd,
  1354.                                                uId,
  1355.                                                GetDlgItem(hwnd, uId),
  1356.                                                1,
  1357.                                                SendMessage);
  1358.                             break;
  1359.                     }
  1360.                     break;
  1361.             }
  1362.             break;
  1363.     }
  1364.  
  1365.     return (FALSE);
  1366. } // AcmAppDriversDlgProc()
  1367.