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 / mixapp / maswitch.c < prev    next >
C/C++ Source or Header  |  1997-10-05  |  20KB  |  749 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) 1993 - 1997  Microsoft Corporation.  All Rights Reserved.
  9. //
  10. //--------------------------------------------------------------------------;
  11. //
  12. //  maswitch.c
  13. //
  14. //  Description:
  15. //
  16. //
  17. //  History:
  18. //       9/21/93
  19. //
  20. //==========================================================================;
  21.  
  22. #include <windows.h>
  23. #include <windowsx.h>
  24. #include <mmsystem.h>
  25.  
  26. #include "mixapp.h"
  27.  
  28. #include "debug.h"
  29.  
  30.  
  31.  
  32.  
  33. //
  34. //
  35. //
  36. typedef struct tMACONTROLINSTANCE_SWITCH
  37. {
  38.     LPMACONTROLINSTANCE             pmaci;
  39.     MIXERCONTROLDETAILS_BOOLEAN     pmxcd_f[];
  40.  
  41. } MACONTROLINSTANCE_SWITCH, *PMACONTROLINSTANCE_SWITCH;
  42.  
  43.  
  44. //==========================================================================;
  45. //
  46. //
  47. //
  48. //
  49. //==========================================================================;
  50.  
  51. //--------------------------------------------------------------------------;
  52. //
  53. //  BOOL MixAppControlChangeSwitch
  54. //
  55. //  Description:
  56. //
  57. //
  58. //  Arguments:
  59. //      HWND hwnd:
  60. //
  61. //      HMIXER hmx:
  62. //
  63. //      DWORD dwControlID:
  64. //
  65. //  Return (BOOL):
  66. //
  67. //  History:
  68. //      09/22/93
  69. //
  70. //--------------------------------------------------------------------------;
  71.  
  72. BOOL FNLOCAL MixAppControlChangeSwitch
  73. (
  74.     HWND                    hwnd,
  75.     HMIXER                  hmx,
  76.     DWORD                   dwControlID
  77. )
  78. {
  79.     MMRESULT                        mmr;
  80.     HWND                            htxt;
  81.     PMACONTROLINSTANCE_SWITCH       pmaci_switch;
  82.     LPMACONTROLINSTANCE             pmaci;
  83.     LPMIXERLINE                     pmxl;
  84.     LPMIXERCONTROL                  pmxctrl;
  85.     PMIXERCONTROLDETAILS_BOOLEAN    pmxcd_f;
  86.     UINT                            cChannels;
  87.     UINT                            cMultipleItems;
  88.     UINT                            u;
  89.     UINT                            uIndex;
  90.     UINT                            v;
  91.     BOOL                            fValue;
  92.     MIXERCONTROLDETAILS             mxcd;
  93.     HWND                            hcheckFocus;
  94.     HWND                            hcheck;
  95.  
  96.  
  97.     hcheckFocus = GetFocus();
  98.     if (NULL == hcheckFocus)
  99.     {
  100.         hcheckFocus = GetDlgItem(hwnd, IDD_MACONTROL_MULTICHANNEL_BASE);
  101.     }
  102.     else
  103.     {
  104.         uIndex = GetDlgCtrlID(hcheckFocus);
  105.         if (uIndex < IDD_MACONTROL_MULTICHANNEL_BASE)
  106.         {
  107.             hcheckFocus = GetDlgItem(hwnd, IDD_MACONTROL_MULTICHANNEL_BASE);
  108.         }
  109.     }
  110.  
  111.  
  112.     //
  113.     //
  114.     //
  115.     pmaci_switch = (PMACONTROLINSTANCE_SWITCH)(UINT)GetWindowLong(hwnd, DWL_USER);
  116.     pmaci        = pmaci_switch->pmaci;
  117.     pmxl         = pmaci->pmxl;
  118.     pmxctrl      = pmaci->pmxctrl;
  119.     pmxcd_f      = &pmaci_switch->pmxcd_f[0];
  120.  
  121.     cChannels = (UINT)pmxl->cChannels;
  122.     if (MIXERCONTROL_CONTROLF_UNIFORM & pmxctrl->fdwControl)
  123.         cChannels = 1;
  124.  
  125.  
  126.     //
  127.     //
  128.     //
  129.     mxcd.cbStruct       = sizeof(mxcd);
  130.     mxcd.dwControlID    = pmxctrl->dwControlID;
  131.     mxcd.cChannels      = cChannels;
  132.     mxcd.cMultipleItems = pmxctrl->cMultipleItems;
  133.     mxcd.cbDetails      = sizeof(*pmxcd_f);
  134.     mxcd.paDetails      = pmxcd_f;
  135.  
  136.     mmr = mixerGetControlDetails((HMIXEROBJ)pmaci->hmx, &mxcd, MIXER_GETCONTROLDETAILSF_VALUE);
  137.     if (MMSYSERR_NOERROR != mmr)
  138.     {
  139.         AppMsgBox(hwnd, MB_OK | MB_ICONEXCLAMATION,
  140.                   "mixerGetControlDetails(ctrlid=%.08lXh) failed on hmx=%.04Xh, mmr=%u!",
  141.                   pmxctrl->dwControlID, pmaci->hmx, mmr);
  142.         return (FALSE);
  143.     }
  144.  
  145.  
  146.     cMultipleItems = 1;
  147.     if (MIXERCONTROL_CONTROLF_MULTIPLE & pmxctrl->fdwControl)
  148.         cMultipleItems = (UINT)pmxctrl->cMultipleItems;
  149.  
  150.  
  151.     for (u = 0; u < cChannels; u++)
  152.     {
  153.         for (v = 0; v < cMultipleItems; v++)
  154.         {
  155.             uIndex = (u * cMultipleItems) + v;
  156.  
  157.             fValue = (BOOL)pmxcd_f[uIndex].fValue;
  158.  
  159.             hcheck = GetDlgItem(hwnd, IDD_MACONTROL_MULTICHANNEL_BASE + uIndex);
  160.             if (hcheckFocus == hcheck)
  161.             {
  162.                 htxt = GetDlgItem(hwnd, IDD_MACONTROL_TXT_VALUE);
  163.                 AppSetWindowText(htxt, "mapped=%d, fValue=%ld",
  164.                                 fValue,
  165.                                 pmxcd_f[uIndex].fValue);
  166.             }
  167.  
  168.             if (fValue == (BOOL)IsDlgButtonChecked(hwnd, IDD_MACONTROL_MULTICHANNEL_BASE + uIndex))
  169.                 continue;
  170.  
  171.             CheckDlgButton(hwnd, IDD_MACONTROL_MULTICHANNEL_BASE + uIndex, fValue);
  172.         }
  173.     }
  174.  
  175.  
  176.  
  177.  
  178.     //
  179.     //
  180.     //
  181.     mxcd.cbStruct       = sizeof(mxcd);
  182.     mxcd.dwControlID    = pmxctrl->dwControlID;
  183.     mxcd.cChannels      = 1;
  184.     mxcd.cMultipleItems = pmxctrl->cMultipleItems;
  185.     mxcd.cbDetails      = sizeof(*pmxcd_f);
  186.     mxcd.paDetails      = pmxcd_f;
  187.  
  188.     mmr = mixerGetControlDetails((HMIXEROBJ)pmaci->hmx, &mxcd, MIXER_GETCONTROLDETAILSF_VALUE);
  189.     if (MMSYSERR_NOERROR != mmr)
  190.     {
  191.         AppMsgBox(hwnd, MB_OK | MB_ICONEXCLAMATION,
  192.                   "mixerGetControlDetails(ctrlid=%.08lXh) failed on hmx=%.04Xh, mmr=%u!",
  193.                   pmxctrl->dwControlID, pmaci->hmx, mmr);
  194.         return (FALSE);
  195.     }
  196.  
  197.  
  198.     for (v = 0; v < cMultipleItems; v++)
  199.     {
  200.         uIndex = v;
  201.  
  202.         fValue = (BOOL)pmxcd_f[uIndex].fValue;
  203.  
  204.         hcheck = GetDlgItem(hwnd, IDD_MACONTROL_UNIFORM_BASE + uIndex);
  205.         if (hcheckFocus == hcheck)
  206.         {
  207.             htxt = GetDlgItem(hwnd, IDD_MACONTROL_TXT_VALUE);
  208.             AppSetWindowText(htxt, "mapped=%d, fValue=%ld",
  209.                              fValue,
  210.                              pmxcd_f[uIndex].fValue);
  211.         }
  212.  
  213.         if (fValue == (BOOL)IsDlgButtonChecked(hwnd, IDD_MACONTROL_UNIFORM_BASE + uIndex))
  214.             continue;
  215.  
  216.         CheckDlgButton(hwnd, IDD_MACONTROL_UNIFORM_BASE + uIndex, fValue);
  217.     }
  218.  
  219.  
  220.     return (TRUE);
  221. } // MixAppControlChangeSwitch()
  222.  
  223.  
  224. //--------------------------------------------------------------------------;
  225. //
  226. //  BOOL MixAppControlSetSwitch
  227. //
  228. //  Description:
  229. //
  230. //
  231. //  Arguments:
  232. //      HWND hwnd:
  233. //
  234. //      HWND hcheck:
  235. //
  236. //  Return (BOOL):
  237. //
  238. //  History:
  239. //      09/22/93
  240. //
  241. //--------------------------------------------------------------------------;
  242.  
  243. BOOL FNLOCAL MixAppControlSetSwitch
  244. (
  245.     HWND                    hwnd,
  246.     HWND                    hcheck
  247. )
  248. {
  249.     PMACONTROLINSTANCE_SWITCH       pmaci_switch;
  250.     LPMACONTROLINSTANCE             pmaci;
  251.     LPMIXERLINE                     pmxl;
  252.     LPMIXERCONTROL                  pmxctrl;
  253.     PMIXERCONTROLDETAILS_BOOLEAN    pmxcd_f;
  254.     MMRESULT                        mmr;
  255.     BOOL                            fValue;
  256.     UINT                            cChannels;
  257.     UINT                            uIndex;
  258.     MIXERCONTROLDETAILS             mxcd;
  259.  
  260.     //
  261.     //
  262.     //
  263.     pmaci_switch = (PMACONTROLINSTANCE_SWITCH)(UINT)GetWindowLong(hwnd, DWL_USER);
  264.     pmaci        = pmaci_switch->pmaci;
  265.     pmxl         = pmaci->pmxl;
  266.     pmxctrl      = pmaci->pmxctrl;
  267.     pmxcd_f      = &pmaci_switch->pmxcd_f[0];
  268.  
  269.     uIndex = GetDlgCtrlID(hcheck);
  270.  
  271.     //
  272.     //  get value and toggle..
  273.     //
  274.     fValue = (0 == IsDlgButtonChecked(hwnd, uIndex));
  275.  
  276.     if (uIndex < IDD_MACONTROL_UNIFORM_BASE)
  277.     {
  278.         cChannels = (UINT)pmxl->cChannels;
  279.         if (MIXERCONTROL_CONTROLF_UNIFORM & pmxctrl->fdwControl)
  280.             cChannels = 1;
  281.  
  282.         uIndex -= IDD_MACONTROL_MULTICHANNEL_BASE;
  283.     }
  284.     else
  285.     {
  286.         cChannels = 1;
  287.  
  288.         uIndex -= IDD_MACONTROL_UNIFORM_BASE;
  289.     }
  290.  
  291.  
  292.     //
  293.     //
  294.     //
  295.     //
  296.     mxcd.cbStruct       = sizeof(mxcd);
  297.     mxcd.dwControlID    = pmxctrl->dwControlID;
  298.     mxcd.cChannels      = cChannels;
  299.     mxcd.cMultipleItems = pmxctrl->cMultipleItems;
  300.     mxcd.cbDetails      = sizeof(*pmxcd_f);
  301.     mxcd.paDetails      = pmxcd_f;
  302.  
  303.     mmr = mixerGetControlDetails((HMIXEROBJ)pmaci->hmx, &mxcd, 0L);
  304.     if (MMSYSERR_NOERROR != mmr)
  305.     {
  306.         AppMsgBox(hwnd, MB_OK | MB_ICONEXCLAMATION,
  307.                   "mixerGetControlDetails(ctrlid=%.08lXh) failed on hmx=%.04Xh, mmr=%u!",
  308.                   pmxctrl->dwControlID, pmaci->hmx, mmr);
  309.         return (FALSE);
  310.     }
  311.  
  312.     pmxcd_f[uIndex].fValue = fValue;
  313.  
  314.     mmr = mixerSetControlDetails((HMIXEROBJ)pmaci->hmx, &mxcd, 0L);
  315.     if (MMSYSERR_NOERROR != mmr)
  316.     {
  317.         AppMsgBox(hwnd, MB_OK | MB_ICONEXCLAMATION,
  318.                   "mixerSetControlDetails(ctrlid=%.08lXh) failed on hmx=%.04Xh, mmr=%u!",
  319.                   pmxctrl->dwControlID, pmaci->hmx, mmr);
  320.         return (FALSE);
  321.     }
  322.  
  323.     CheckDlgButton(hwnd, GetDlgCtrlID(hcheck), (BOOL)pmxcd_f[uIndex].fValue);
  324. #if 0
  325.     if (0 == uIndex)
  326.     {
  327.         htxt = GetDlgItem(hwnd, IDD_MACONTROL_TXT_VALUE);
  328.         AppSetWindowText(htxt, "mapped=%d, fValue=%ld",
  329.                          nValue,
  330.                          pmxcd_f[uIndex].fValue);
  331.     }
  332. #endif
  333.  
  334.     return (TRUE);
  335. } // MixAppControlSetSwitch()
  336.  
  337.  
  338. //--------------------------------------------------------------------------;
  339. //
  340. //  BOOL MixAppLineChangeSwitch
  341. //
  342. //  Description:
  343. //
  344. //
  345. //  Arguments:
  346. //      HWND hwnd:
  347. //
  348. //      HMIXER hmx:
  349. //
  350. //      DWORD dwLineID:
  351. //
  352. //  Return (BOOL):
  353. //
  354. //  History:
  355. //      09/24/93
  356. //
  357. //--------------------------------------------------------------------------;
  358.  
  359. BOOL FNLOCAL MixAppLineChangeSwitch
  360. (
  361.     HWND                    hwnd,
  362.     HMIXER                  hmx,
  363.     DWORD                   dwLineID
  364. )
  365. {
  366.     MMRESULT                    mmr;
  367.     PMACONTROLINSTANCE_SWITCH   pmaci_switch;
  368.     LPMACONTROLINSTANCE         pmaci;
  369.     LPMIXERLINE                 pmxl;
  370.     MIXERLINE                   mxl;
  371.     BOOL                        fSource;
  372.     BOOL                        fActive;
  373.     BOOL                        fDisconnected;
  374.     HWND                        htxt;
  375.  
  376.  
  377.     //
  378.     //
  379.     //
  380.     pmaci_switch = (PMACONTROLINSTANCE_SWITCH)(UINT)GetWindowLong(hwnd, DWL_USER);
  381.     pmaci       = pmaci_switch->pmaci;
  382.     pmxl        = pmaci->pmxl;
  383.  
  384.     if (pmxl->dwLineID != dwLineID)
  385.     {
  386.         DPF(0, "!MixAppLineChangeSwitch: why am i getting notifications for some other line??");
  387.  
  388.         //
  389.         //  this would be a bug in this app... keep from bombing though
  390.         //  until i fix it.
  391.         //
  392.         dwLineID = pmxl->dwLineID;
  393.     }
  394.  
  395.     //
  396.     //  get the current state of the line that changed.. this is actually
  397.     //  silly that you have to do this just to determine if the line went
  398.     //  [in]active. sigh..
  399.     //
  400.     mxl.cbStruct      = sizeof(mxl);
  401.     mxl.dwLineID      = dwLineID;
  402.  
  403.     mmr = mixerGetLineInfo((HMIXEROBJ)ghmx, &mxl, MIXER_GETLINEINFOF_LINEID);
  404.     if (MMSYSERR_NOERROR != mmr)
  405.     {
  406.         AppMsgBox(hwnd, MB_OK | MB_ICONEXCLAMATION,
  407.                   "mixerGetLineInfo(lineid=%.08lXh) failed on hmx=%.04Xh, mmr=%u!",
  408.                   dwLineID, ghmx, mmr);
  409.  
  410.         return (FALSE);
  411.     }
  412.  
  413.     fSource       = (0 != (MIXERLINE_LINEF_SOURCE & mxl.fdwLine));
  414.     fActive       = (0 != (MIXERLINE_LINEF_ACTIVE & mxl.fdwLine));
  415.     fDisconnected = (0 != (MIXERLINE_LINEF_DISCONNECTED & mxl.fdwLine));
  416.  
  417.  
  418.     htxt = GetDlgItem(hwnd, IDD_MACONTROL_TXT_LINEINFO);
  419.     AppSetWindowText(htxt, "(%s), '%s', %s, %s",
  420.                      fSource ? (LPSTR)"src" : (LPSTR)"DST",
  421.                      (LPSTR)mxl.szShortName,
  422.                      fActive ? (LPSTR)"ACTIVE" : (LPSTR)"inactive",
  423.                      fDisconnected ? (LPSTR)"DISCONNECTED" : (LPSTR)"connected");
  424.  
  425.     return (fActive);
  426. } // MixAppLineChangeSwitch()
  427.  
  428.  
  429. //--------------------------------------------------------------------------;
  430. //
  431. //  BOOL MixAppInitDialogSwitch
  432. //
  433. //  Description:
  434. //
  435. //
  436. //  Arguments:
  437. //      HWND hwnd:
  438. //
  439. //      HWND hwndFocus:
  440. //
  441. //      LPARAM lParam:
  442. //
  443. //  Return (BOOL):
  444. //
  445. //  History:
  446. //      09/22/93
  447. //
  448. //--------------------------------------------------------------------------;
  449.  
  450. BOOL FNLOCAL MixAppInitDialogSwitch
  451. (
  452.     HWND                    hwnd,
  453.     HWND                    hwndFocus,
  454.     LPARAM                  lParam
  455. )
  456. {
  457.     #define FCB_DEF_STYLE   (WS_VISIBLE | WS_CHILD | BS_CHECKBOX | WS_TABSTOP)
  458.  
  459.     static TCHAR        szButton[]  = TEXT("button");
  460.     static TCHAR        szTitle[]   = TEXT("Switch Class: '%s'");
  461.  
  462.     TCHAR                       szControlType[64];
  463.     LPMACONTROLINSTANCE         pmaci;
  464.     PMACONTROLINSTANCE_SWITCH   pmaci_switch;
  465.  
  466.     LPMIXERLINE                 pmxl;
  467.     LPMIXERCONTROL              pmxctrl;
  468.  
  469.     HWND                        htxt;
  470.     UINT                        u;
  471.     UINT                        v;
  472.     HWND                        hcheck;
  473.     RECT                        rcM;
  474.     RECT                        rcU;
  475.     int                         cycap;
  476.     UINT                        cb;
  477.     UINT                        cChannels;
  478.     UINT                        cMultipleItems;
  479.     UINT                        uIndex;
  480.  
  481.  
  482.     //
  483.     //
  484.     //
  485.     pmaci = (LPMACONTROLINSTANCE)lParam;
  486.     if (NULL == pmaci)
  487.     {
  488.         DPF(0, "!MixAppInitDialogSwitch: pmaci passed in lParam is NULL!?!");
  489.         return (FALSE);
  490.     }
  491.  
  492.     pmxl    = pmaci->pmxl;
  493.     pmxctrl = pmaci->pmxctrl;
  494.  
  495.     if (!MixAppGetControlTypeName(pmxctrl, szControlType))
  496.     {
  497.         return (FALSE);
  498.     }
  499.  
  500.     //
  501.     //
  502.     //
  503.     switch (pmxctrl->dwControlType)
  504.     {
  505.         case MIXERCONTROL_CONTROLTYPE_BOOLEAN:
  506.         case MIXERCONTROL_CONTROLTYPE_ONOFF:
  507.         case MIXERCONTROL_CONTROLTYPE_MUTE:
  508.         case MIXERCONTROL_CONTROLTYPE_MONO:
  509.         case MIXERCONTROL_CONTROLTYPE_LOUDNESS:
  510.         case MIXERCONTROL_CONTROLTYPE_STEREOENH:
  511.             break;
  512.  
  513.         default:
  514.             DPF(0, "!MixAppInitDialogSwitch: pmxctrl->dwControlType=%.08lXh not valid switch!", pmxctrl->dwControlType);
  515.             return (FALSE);
  516.     }
  517.  
  518.  
  519.  
  520.     //
  521.     //
  522.     //
  523.     AppSetWindowText(hwnd, szTitle, (LPTSTR)szControlType);
  524.     SetDlgItemText(hwnd, IDD_MACONTROL_TXT_SHORT_NAME, pmxctrl->szShortName);
  525.     SetDlgItemText(hwnd, IDD_MACONTROL_TXT_LONG_NAME,  pmxctrl->szName);
  526.  
  527.     htxt = GetDlgItem(hwnd, IDD_MACONTROL_TXT_BOUNDS);
  528.     AppSetWindowText(htxt, "dwMinimum=%lu, dwMaximum=%lu",
  529.                      pmxctrl->Bounds.dwMinimum,
  530.                      pmxctrl->Bounds.dwMaximum);
  531.  
  532.     htxt = GetDlgItem(hwnd, IDD_MACONTROL_TXT_METRICS);
  533.     AppSetWindowText(htxt, "N/A");
  534.  
  535.  
  536.  
  537.     //
  538.     //
  539.     //
  540.     cChannels = (UINT)pmxl->cChannels;
  541.     if (MIXERCONTROL_CONTROLF_UNIFORM & pmxctrl->fdwControl)
  542.         cChannels = 1;
  543.  
  544.     cMultipleItems = 1;
  545.     if (MIXERCONTROL_CONTROLF_MULTIPLE & pmxctrl->fdwControl)
  546.         cMultipleItems = (UINT)pmxctrl->cMultipleItems;
  547.  
  548.     cb  = sizeof(*pmaci_switch);
  549.     cb += cChannels * cMultipleItems * sizeof(pmaci_switch->pmxcd_f[0]);
  550.     pmaci_switch = (PMACONTROLINSTANCE_SWITCH)LocalAlloc(LPTR, cb);
  551.     if (NULL == pmaci_switch)
  552.     {
  553.         DPF(0, "!MixAppInitDialogSwitch: failed trying to alloc %u bytes for control instance!", cb);
  554.         return (FALSE);
  555.     }
  556.  
  557.  
  558.     //
  559.     //
  560.     //
  561.     SetWindowLong(hwnd, DWL_USER, (LPARAM)(UINT)pmaci_switch);
  562.  
  563.     pmaci_switch->pmaci    = pmaci;
  564.  
  565.  
  566.     //
  567.     //
  568.     //
  569.     //
  570.     cycap = GetSystemMetrics(SM_CYCAPTION);
  571.  
  572.     hcheck = GetDlgItem(hwnd, IDD_MACONTROL_GRP_MULTICHANNEL);
  573.     GetWindowRect(hcheck, &rcM);
  574.  
  575.     InflateRect(&rcM, -10, -20);
  576.     ScreenToClient(hwnd, (LPPOINT)&rcM.left);
  577.     ScreenToClient(hwnd, (LPPOINT)&rcM.right);
  578.  
  579.     rcM.bottom = rcM.top + cycap;
  580.  
  581.     for (u = 0; u < cChannels; u++)
  582.     {
  583.         for (v = 0; v < cMultipleItems; v++)
  584.         {
  585.             uIndex = (u * cMultipleItems) + v;
  586.  
  587.             hcheck = CreateWindow(szButton, pmxctrl->szShortName, FCB_DEF_STYLE,
  588.                                   rcM.left, rcM.top,
  589.                                   rcM.right - rcM.left,
  590.                                   rcM.bottom - rcM.top,
  591.                                   hwnd, (HMENU)(IDD_MACONTROL_MULTICHANNEL_BASE + uIndex),
  592.                                   ghinst, NULL);
  593.  
  594.             rcM.top    += cycap + 4;
  595.             rcM.bottom += cycap + 4;
  596.         }
  597.  
  598.         //
  599.         //  add more separation between channels
  600.         //
  601.         rcM.top    += cycap;
  602.         rcM.bottom += cycap;
  603.     }
  604.  
  605.  
  606.     //
  607.     //
  608.     //
  609.     //
  610.     hcheck = GetDlgItem(hwnd, IDD_MACONTROL_GRP_UNIFORM);
  611.     GetWindowRect(hcheck, &rcU);
  612.  
  613.     InflateRect(&rcU, -10, -20);
  614.     ScreenToClient(hwnd, (LPPOINT)&rcU.left);
  615.     ScreenToClient(hwnd, (LPPOINT)&rcU.right);
  616.  
  617.     rcU.bottom = rcU.top + cycap;
  618.  
  619.     for (v = 0; v < cMultipleItems; v++)
  620.     {
  621.         hcheck = CreateWindow(szButton, pmxctrl->szShortName, FCB_DEF_STYLE,
  622.                               rcU.left, rcU.top,
  623.                               rcU.right - rcU.left,
  624.                               rcU.bottom - rcU.top,
  625.                               hwnd, (HMENU)(IDD_MACONTROL_UNIFORM_BASE + v),
  626.                               ghinst, NULL);
  627.  
  628.         rcU.top    += cycap + 4;
  629.         rcU.bottom += cycap + 4;
  630.     }
  631.  
  632.  
  633.     //
  634.     //
  635.     //
  636.     SendMessage(hwnd,
  637.                 MM_MIXM_LINE_CHANGE,
  638.                 (WPARAM)pmaci->hmx,
  639.                 pmxl->dwLineID);
  640.  
  641.     SendMessage(hwnd,
  642.                 MM_MIXM_CONTROL_CHANGE,
  643.                 (WPARAM)pmaci->hmx,
  644.                 pmxctrl->dwControlID);
  645.  
  646.     return (TRUE);
  647. } // MixAppInitDialogSwitch()
  648.  
  649.  
  650. //==========================================================================;
  651. //
  652. //
  653. //
  654. //
  655. //==========================================================================;
  656.  
  657. //--------------------------------------------------------------------------;
  658. //
  659. //  BOOL MixAppDlgProcControlSwitch
  660. //
  661. //  Description:
  662. //
  663. //
  664. //  Arguments:
  665. //      HWND hwnd:
  666. //
  667. //      UINT uMsg:
  668. //
  669. //      WPARAM wParam:
  670. //
  671. //      LPARAM lParam:
  672. //
  673. //  Return (BOOL):
  674. //
  675. //  History:
  676. //      07/22/93
  677. //
  678. //--------------------------------------------------------------------------;
  679.  
  680. BOOL CALLBACK MixAppDlgProcControlSwitch
  681. (
  682.     HWND                    hwnd,
  683.     UINT                    uMsg,
  684.     WPARAM                  wParam,
  685.     LPARAM                  lParam
  686. )
  687. {
  688.     LRESULT             lr;
  689.     HLOCAL              hl;
  690.     UINT                uId;
  691.  
  692.  
  693.     if (WM_COMMAND == uMsg)
  694.     {
  695.         uId = GET_WM_COMMAND_ID(wParam, lParam);
  696.         if (IDD_MACONTROL_GRP_MULTICHANNEL <= uId)
  697.         {
  698.             MixAppControlSetSwitch(hwnd, GET_WM_COMMAND_HWND(wParam, lParam));
  699.             return (TRUE);
  700.         }
  701.     }
  702.  
  703.  
  704.     //
  705.     //
  706.     //
  707.     switch (uMsg)
  708.     {
  709.         case WM_INITDIALOG:
  710.             lr = HANDLE_WM_INITDIALOG(hwnd, wParam, lParam, MixAppInitDialogSwitch);
  711.             if (FALSE == lr)
  712.             {
  713.                 EndDialog(hwnd, FALSE);
  714.             }
  715.             else
  716.             {
  717.                 ghdlgControl = hwnd;
  718.             }
  719.             return (TRUE);
  720.  
  721.  
  722.         case MM_MIXM_LINE_CHANGE:
  723.             MixAppLineChangeSwitch(hwnd, (HMIXER)wParam, lParam);
  724.             return (TRUE);
  725.  
  726.         case MM_MIXM_CONTROL_CHANGE:
  727.             MixAppControlChangeSwitch(hwnd, (HMIXER)wParam, lParam);
  728.             return (TRUE);
  729.  
  730.  
  731.         case WM_COMMAND:
  732.             uId = GET_WM_COMMAND_ID(wParam, lParam);
  733.             switch (uId)
  734.             {
  735.                 case IDCANCEL:
  736.                 case IDOK:
  737.                     hl = (HLOCAL)(UINT)GetWindowLong(hwnd, DWL_USER);
  738.                     LocalFree(hl);
  739.  
  740.                     EndDialog(hwnd, TRUE);
  741.                     ghdlgControl = NULL;
  742.                     break;
  743.             }
  744.             break;
  745.     }
  746.  
  747.     return (FALSE);
  748. } // MixAppDlgProcControlSwitch()
  749.