home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / viscobv6.zip / vac22os2 / ibmcobol / samples / toolkit / mm / mcispy / dlgprocs.c next >
C/C++ Source or Header  |  1996-11-19  |  42KB  |  1,110 lines

  1. #define INCL_DOS                       /* DosCall Definitions include     */
  2. #define INCL_PM                        /* Presentation Manager include    */
  3. #define INCL_WIN                       /* OS/2 2.x Win  include           */
  4. #define INCL_OS2MM                     /* OS/2 2.x Win  include           */
  5. #include <os2.h>                       /* OS/2 2.x System include         */
  6. #include <string.h>                    /* C String Functions include      */
  7. #include <stdio.h>                     /* C String Functions include      */
  8. #include <stdlib.h>                    /* C String Functions include      */
  9. #include <os2me.h>                     /* Multimedia System include       */
  10. #include "mcispy.h"                    /* Component Private Definitions   */
  11.  
  12. extern   MCISPY_BLOCK      SpyBlock;
  13. extern   MCIMessageTable   MCIMsgTbl[];   /* MCI Message Table       */
  14.  
  15. /****************************START OF SPECIFICATIONS *************************
  16. *
  17. * FUNCTION:   ViewInstDevDlgProc
  18. *
  19. * ARGUMENTS:  HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2
  20. *
  21. * RETURN:     None
  22. *
  23. * DESCRIPTION: Command Monitor Window  Procedure
  24. *
  25. *****************************END OF SPECIFICATIONS ***************************/
  26. MRESULT EXPENTRY ViewInstDevDlgProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
  27. {
  28.  
  29.   SZ    szFontName[50];         /* Font Name Array   */
  30.   SHORT sDataIndex;              /* Data Item Index   */
  31.   SHORT k   = 0;                 /* Loop Indicies     */
  32.   char  buffer[2048];            /* Temporary Storage */
  33.   char space[] = "               ";/* Text Allignment */
  34.   char tokensep[]=" \t";         /* Token Separotor   */
  35.  
  36.   switch(msg)
  37.     {
  38.     case WM_CONTROL:
  39.  
  40.       if ( SHORT2FROMMP ( mp1 ) ==  LN_SELECT )
  41.        {
  42.            WinSendDlgItemMsg(hwnd,LI_DEVNAMES, LM_SELECTITEM,MPFROMSHORT(LIT_NONE),0L);
  43.        }
  44.       break;
  45.  
  46.     case WM_COMMAND:
  47.       switch (SHORT1FROMMP(mp1))
  48.         {
  49.         case PB_OK:
  50.           WinDismissDlg (hwnd,PB_OK);
  51.         break;
  52.  
  53.         case DID_CANCEL:
  54.           /* Dismiss the dialog box */
  55.           WinDismissDlg (hwnd,DID_CANCEL);
  56.         break;
  57.  
  58.         case PB_HELP:
  59.           if ( SpyBlock.hwndHelpInstance )
  60.               WinSendMsg (SpyBlock.hwndHelpInstance, HM_DISPLAY_HELP,
  61.                       MPFROM2SHORT(INSTDEVHLP, NULL),
  62.                       MPFROMSHORT(HM_RESOURCEID));
  63.         break;
  64.         }
  65.         break;
  66.     case WM_INITDLG:
  67.       /* Max no. of chars for Device Names list is 512 */
  68.       WinSendDlgItemMsg(hwnd,LI_DEVNAMES, EM_SETTEXTLIMIT,MPFROMSHORT(16382),0L);
  69.       WinSendDlgItemMsg(hwnd,LI_DEVNAMES, EM_SETREADONLY,MPFROMSHORT(TRUE),0L);
  70.  
  71.       strcpy (szFontName,"10.System Monospaced");
  72.       WinSetPresParam (hwnd, PP_FONTNAMESIZE,(ULONG)(strlen(szFontName)+(ULONG)1),
  73.                        (PSZ) szFontName);
  74.  
  75.  
  76.       /* Query Installed devices and initialize */
  77.  
  78.       for (k = 0; k < SpyBlock.usNumDevices ; k++ )
  79.         {
  80.          if (SpyBlock.PhysicalDevData[k].szLogDevName == NULL)
  81.             break;
  82.          strcpy (buffer,SpyBlock.PhysicalDevData[k].szLogDevName);
  83.  
  84.          strncat (buffer, space,
  85.                   20-strlen(SpyBlock.PhysicalDevData[k].szLogDevName));
  86.  
  87.          strcat (buffer,SpyBlock.PhysicalDevData[k].szPhysicalDevName);
  88.  
  89.          strncat (buffer, space,
  90.                   15-strlen(SpyBlock.PhysicalDevData[k].szPhysicalDevName));
  91.  
  92.          strcat (buffer,SpyBlock.PhysicalDevData[k].szProductInfo);
  93.  
  94.          InsertListItem (LI_DEVNAMES,LIT_SORTASCENDING,buffer);
  95.         }
  96.       break;
  97.  
  98.     case WM_PAINT:
  99.         /* Execute default processing */
  100.         return(WinDefDlgProc(hwnd,msg,mp1,mp2));
  101.         break;
  102.  
  103.     default:
  104.         return(WinDefDlgProc(hwnd,msg,mp1,mp2));
  105.     }
  106.     return(FALSE);
  107. }
  108.  
  109. /****************************START OF SPECIFICATIONS *************************
  110. *
  111. * FUNCTION:   FilterDevTypDlgProc
  112. *
  113. * ARGUMENTS:  HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2
  114. *
  115. * RETURN:     None
  116. *
  117. * DESCRIPTION: Message Filters Dialog  Procedure
  118. *****************************END OF SPECIFICATIONS ***************************/
  119. MRESULT EXPENTRY FilterDevTypDlgProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
  120. {
  121.  
  122.   SZ      szFontName[124];         /* Font Name array   */
  123.   static SHORT   sDataIndex = 0;   /* Data Item Index   */
  124.   RC      ReturnCode;              /* API Return Code   */
  125.   PCHAR   pchWord;                 /* Temporary pointer */
  126.   USHORT  i = 0;                   /* Loop Index        */
  127.   SZ      buffer [1024];           /* Char buffer       */
  128.   SZ      TokenSep[]=" \t";        /* Token Delimiters  */
  129.   SZ      TempBuffer[124];         /* Char buffer       */
  130.   BOOL    fAlias = FALSE;          /* Alias or DeviceID */
  131.   static  SHORT   sDataIndicies[20];/* Previous Filters */
  132.   static  SHORT   sCount;           /* Previous Filters */
  133.  
  134.   MCIDevTypTable   MCIDevTbl[]={
  135.   MCI_DEVTYPE_VIDEOTAPE,            "Videotape",
  136.   MCI_DEVTYPE_VIDEODISC,            "Videodisc",
  137.   MCI_DEVTYPE_CD_AUDIO,             "CDaudio",
  138.   MCI_DEVTYPE_DAT,                  "DAT",
  139.   MCI_DEVTYPE_AUDIO_TAPE,           "Audiotape",
  140.   MCI_DEVTYPE_OTHER,                "Other",
  141.   MCI_DEVTYPE_WAVEFORM_AUDIO,       "Waveaudio",
  142.   MCI_DEVTYPE_SEQUENCER,            "Sequencer",
  143.   MCI_DEVTYPE_AUDIO_AMPMIX,         "Ampmix",
  144.   MCI_DEVTYPE_OVERLAY,              "Overlay",
  145.   MCI_DEVTYPE_ANIMATION,            "Animation",
  146.   MCI_DEVTYPE_DIGITAL_VIDEO,        "Digitalvideo",
  147.   MCI_DEVTYPE_SPEAKER,              "Speaker",
  148.   MCI_DEVTYPE_HEADPHONE,            "Headphone",
  149.   MCI_DEVTYPE_MICROPHONE,           "Microphone",
  150.   MCI_DEVTYPE_MONITOR,              "Monitor",
  151.   MCI_DEVTYPE_CDXA,                 "CDXA"
  152.   };
  153.  
  154.   switch(msg)
  155.     {
  156.     case WM_CONTROL:
  157.       break;
  158.  
  159.     case WM_COMMAND:
  160.       switch (SHORT1FROMMP(mp1))
  161.         {
  162.         case PB_OK:
  163.           sDataIndex = 0;
  164.           SpyBlock.fDevTypFil = FALSE;
  165.           SpyBlock.usNumFilDevs = 0;
  166.           sCount = 0;
  167.           /* Reset existing filters and refresh the list */
  168.           memset(&SpyBlock.ulDevTypFil,0,sizeof(SpyBlock.ulDevTypFil));
  169.           memset(&SpyBlock.szDevTypFil,0,sizeof(SpyBlock.szDevTypFil));
  170.           memset(&sDataIndicies,0,sizeof(sDataIndicies));
  171.  
  172.           sDataIndex = SHORT1FROMMR( WinSendDlgItemMsg( hwnd,LI_FILTERDEVS,
  173.                                         LM_QUERYSELECTION,(MPARAM)LIT_FIRST,
  174.                                         (MPARAM) 0L ) );
  175.           sDataIndicies[0] = sDataIndex;
  176.           sCount++;
  177.           SpyBlock.usNumFilDevs++;
  178.           if (sDataIndex != LIT_NONE)
  179.            {
  180.               WinSendDlgItemMsg( hwnd, LI_FILTERDEVS, LM_QUERYITEMTEXT,
  181.                                  MPFROM2SHORT(sDataIndex,80), TempBuffer );
  182.  
  183.               pchWord = strtok (TempBuffer,TokenSep);
  184.               if (pchWord == NULL)
  185.                  break;
  186.  
  187.               SpyBlock.ulDevTypFil[0]= atol(pchWord);
  188.  
  189.               /* Get The String Device Type */
  190.  
  191.               pchWord = strtok (NULL,TokenSep);
  192.  
  193.               strcpy (SpyBlock.szDevTypFil[0],pchWord);
  194.  
  195.               SpyBlock.fDevTypFil = TRUE;
  196.            } /* No Slection */
  197.  
  198.            while (sDataIndex != LIT_NONE)
  199.              {
  200.                sDataIndex = SHORT1FROMMR( WinSendDlgItemMsg( hwnd,LI_FILTERDEVS,
  201.                                              LM_QUERYSELECTION,(MPARAM)sDataIndex,
  202.                                              (MPARAM) 0L ) );
  203.  
  204.                if (sDataIndex == LIT_NONE)
  205.                break;
  206.  
  207.                sDataIndicies[sCount] = sDataIndex;
  208.                WinSendDlgItemMsg( hwnd, LI_FILTERDEVS, LM_QUERYITEMTEXT,
  209.                                   MPFROM2SHORT(sDataIndex,80), TempBuffer );
  210.  
  211.                pchWord = strtok (TempBuffer,TokenSep);
  212.  
  213.                SpyBlock.ulDevTypFil[sCount]= atol(pchWord);
  214.  
  215.               /* Get The String Device Type */
  216.  
  217.               pchWord = strtok (NULL,TokenSep);
  218.  
  219.               strcpy (SpyBlock.szDevTypFil[sCount],pchWord);
  220.               i++;
  221.               sCount++;
  222.               SpyBlock.usNumFilDevs++;
  223.               if (i > MAXDEVICES)
  224.                  break;
  225.              } /* While */
  226.           WinDismissDlg (hwnd,PB_OK);
  227.           break;
  228.  
  229.           case DID_CANCEL:
  230.             /* Dismiss the dialog box */
  231.             WinDismissDlg (hwnd,DID_CANCEL);
  232.           break;
  233.  
  234.         case PB_HELP:
  235.           if ( SpyBlock.hwndHelpInstance )
  236.               WinSendMsg (SpyBlock.hwndHelpInstance, HM_DISPLAY_HELP,
  237.                       MPFROM2SHORT(FILTERDEVTYPHLP, NULL),
  238.                       MPFROMSHORT(HM_RESOURCEID));
  239.           break;
  240.         }
  241.       break;
  242.     case WM_INITDLG:
  243.       /* Max no. of chars for Device Names list is 512 */
  244.       WinSendDlgItemMsg(hwnd,LI_FILTERDEVS,
  245.                         EM_SETTEXTLIMIT,MPFROMSHORT(4096),0L);
  246.  
  247.       strcpy (szFontName,"10.System Monospaced");
  248.  
  249.       WinSetPresParam (hwnd,PP_FONTNAMESIZE,
  250.                        (ULONG)((ULONG) strlen(szFontName)+(ULONG)1),
  251.                        (PSZ) szFontName);
  252.  
  253.       for (i=0; i < 17; i++)
  254.         {
  255.            strcpy (buffer,(char *)LongToString(MCIDevTbl[i].usDevType));
  256.            if (i <= 9)
  257.               strcat (buffer,"         " );
  258.            else
  259.               strcat (buffer,"        ");
  260.            strcat (buffer,MCIDevTbl[i].szDevType);
  261.            InsertListItem (LI_FILTERDEVS,LIT_END,buffer);
  262.         }
  263.  
  264.       if (SpyBlock.fDevTypFil)
  265.        {
  266.           for (i=0; i < sCount; i++)
  267.             {
  268.                WinSendDlgItemMsg(hwnd,LI_FILTERDEVS,LM_SELECTITEM,
  269.                                  MPFROMSHORT(sDataIndicies[i]),MPFROMSHORT(TRUE));
  270.             }
  271.        }
  272.  
  273.       break;
  274.  
  275.     case WM_PAINT:
  276.         /* Execute default processing */
  277.  
  278.         return(WinDefDlgProc(hwnd,msg,mp1,mp2));
  279.  
  280.         break;
  281.     default:
  282.         return(WinDefDlgProc(hwnd,msg,mp1,mp2));
  283.   }
  284.   return(FALSE);
  285. }
  286. /****************************START OF SPECIFICATIONS *************************
  287. *
  288. * FUNCTION:   FilterDevIdDlgProc
  289. *
  290. * ARGUMENTS:  HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2
  291. *
  292. * RETURN:     None
  293. *
  294. * DESCRIPTION: Message Filters Dialog  Procedure
  295. *
  296. *****************************END OF SPECIFICATIONS ***************************/
  297.  
  298. MRESULT EXPENTRY FilterDevIdDlgProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
  299. {
  300.  
  301.   SZ      szFontName[124];         /* Font name Array   */
  302.   SHORT   sDataIndex;              /* Data Item Index   */
  303.   APIRET  rc;                      /* API Return Code   */
  304.   PCHAR   pchWord;                 /* Temporary pointer */
  305.   USHORT  i;                       /* Loop Index        */
  306.   SZ      buffer[1024];            /* Temporary buffer  */
  307.   SZ      TokenSep[]=" \t";        /* Token Delimiters  */
  308.   SZ      TempBuffer[124];         /* Temporary buffer  */
  309.   BOOL   fAlias = FALSE;           /* Alias or Device   */
  310.   ULONG  ulTempId;                 /* Temp Device Id    */
  311.   ULONG  ulPID;                    /* Temp Process Id   */
  312.   ULONG  ulCount;                  /* Selection Count   */
  313.  
  314.   switch(msg)
  315.     {
  316.     case WM_CONTROL:
  317.       break;
  318.  
  319.     case WM_COMMAND:
  320.       switch (SHORT1FROMMP(mp1))
  321.         {
  322.         case PB_OK:
  323.           ulCount = 0L;
  324.           sDataIndex = 0;
  325.  
  326.           /* Reset existing filters and refresh the list */
  327.  
  328.           for (i= 0; i < MAXOPENS; i++)
  329.             {
  330.                SpyBlock.OpenList.ulOpenList[i].fExclude = FALSE;
  331.             }
  332.           for (i= 0; i < MAXOPENS; i++)
  333.             {
  334.                SpyBlock.OpenList.szAlias[i].fExclude = FALSE;
  335.             }
  336.  
  337.           sDataIndex = SHORT1FROMMR( WinSendDlgItemMsg( hwnd,LI_OPENINST,
  338.                                        LM_QUERYSELECTION,(MPARAM)LIT_FIRST,
  339.                                        (MPARAM) 0L ) );
  340.  
  341.           if (sDataIndex != LIT_NONE)
  342.            {
  343.               WinSendDlgItemMsg( hwnd, LI_OPENINST, LM_QUERYITEMTEXT,
  344.                                  MPFROM2SHORT(sDataIndex,80), TempBuffer );
  345.  
  346.               /* This Will be the PID  */
  347.  
  348.               pchWord = strtok (TempBuffer,TokenSep);
  349.  
  350.               ulPID = atoi(pchWord);
  351.               /* Second Token is the Device ID or Alias */
  352.  
  353.               pchWord = strtok (NULL,TokenSep);
  354.  
  355.               for (i=0; i < MAXOPENS; i++)
  356.                 {
  357.                    if (SpyBlock.OpenList.szAlias[i].ulPID == ulPID)
  358.                     {
  359.                        if (stricmp (SpyBlock.OpenList.szAlias[i].szAlias,pchWord) == 0)
  360.                         {
  361.                           SpyBlock.OpenList.szAlias[i].fExclude = TRUE;
  362.                           fAlias = TRUE;
  363.                           SpyBlock.fDevIdFil = TRUE;
  364.                           break;
  365.                         } /* Found Alias */
  366.                     } /* Found PID */
  367.                 } /* Max Opens */
  368.               if (!fAlias)
  369.                {
  370.                   ulTempId = atoi(pchWord);
  371.                   for (i=0; i < MAXOPENS; i++)
  372.                     {
  373.                        if (SpyBlock.OpenList.ulOpenList[i].ulDevId == ulTempId)
  374.                         {
  375.                           SpyBlock.OpenList.ulOpenList[i].fExclude = TRUE;
  376.                           SpyBlock.fDevIdFil = TRUE;
  377.                           break;
  378.                         }
  379.                     }
  380.                } /* Not an Alias */
  381.  
  382.               while (sDataIndex != LIT_NONE)
  383.                 {
  384.                   fAlias = FALSE;
  385.                   ulCount++;
  386.                   sDataIndex = SHORT1FROMMR( WinSendDlgItemMsg( hwnd,
  387.                                                LI_OPENINST, LM_QUERYSELECTION,
  388.                                                (MPARAM)sDataIndex,(MPARAM) 0L ) );
  389.  
  390.  
  391.  
  392.                   if (sDataIndex != LIT_NONE)
  393.                    {
  394.                       WinSendDlgItemMsg( hwnd, LI_OPENINST, LM_QUERYITEMTEXT,
  395.                                          MPFROM2SHORT(sDataIndex,80), TempBuffer );
  396.  
  397.                       pchWord = strtok (TempBuffer,TokenSep);
  398.  
  399.                       ulPID = atoi(pchWord);
  400.  
  401.                       /* Second Token is the Device ID or Alias */
  402.                       pchWord = strtok (NULL,TokenSep);
  403.  
  404.                       for (i=0; i < MAXOPENS; i++)
  405.                         {
  406.                            if (SpyBlock.OpenList.szAlias[i].ulPID == ulPID)
  407.                             {
  408.                                if (strcmp (SpyBlock.OpenList.szAlias[i].szAlias,pchWord) == 0)
  409.                                 {
  410.                                   SpyBlock.OpenList.szAlias[i].fExclude = TRUE;
  411.                                   fAlias = TRUE;
  412.                                   break;
  413.                                 } /* Found Alias */
  414.                             } /* Found PID */
  415.                         } /* Max Devices */
  416.                       if (!fAlias)
  417.                        {
  418.                           ulTempId = atoi(pchWord);
  419.                           for (i=0; i < MAXOPENS; i++)
  420.                             {
  421.                                if (SpyBlock.OpenList.ulOpenList[i].ulDevId == ulTempId)
  422.                                 {
  423.                                   SpyBlock.OpenList.ulOpenList[i].fExclude = TRUE;
  424.                                   break;
  425.                                 }
  426.                             }
  427.                        } /* Not an Alias */
  428.  
  429.                    } /* LIT_NONE */
  430.                 } /* While */
  431.            } /* No Selection */
  432.           WinDismissDlg (hwnd,PB_OK);
  433.          break;
  434.  
  435.         case DID_CANCEL:
  436.           /* Dismiss the dialog box */
  437.           WinDismissDlg (hwnd,DID_CANCEL);
  438.          break;
  439.  
  440.         case PB_HELP:
  441.           if ( SpyBlock.hwndHelpInstance )
  442.               WinSendMsg (SpyBlock.hwndHelpInstance, HM_DISPLAY_HELP,
  443.                       MPFROM2SHORT(FILTERDEVIDHLP, NULL),
  444.                       MPFROMSHORT(HM_RESOURCEID));
  445.          break;
  446.         }
  447.         break;
  448.  
  449.     case WM_INITDLG:
  450.         /* Max no. of chars for Device Names list is 512 */
  451.         strcpy (szFontName,"10.System Monospaced");
  452.         WinSetPresParam (hwnd,
  453.                          PP_FONTNAMESIZE,
  454.                          (ULONG)((ULONG) strlen(szFontName)+(ULONG)1),
  455.                          (PSZ) szFontName);
  456.  
  457.         /* Begin Insertion of Open Device IDs into the list */
  458.  
  459.         for (i= 0; i < MAXOPENS; i++)
  460.           {
  461.              if (SpyBlock.OpenList.ulOpenList[i].ulDevId != 0)
  462.               {
  463.                  strcpy (buffer,
  464.                          (char *)LongToString(SpyBlock.OpenList.ulOpenList[i].ulPID));
  465.                  strcat (buffer,"     ");
  466.                  strcat (buffer,
  467.                          (char *)LongToString(SpyBlock.OpenList.ulOpenList[i].ulDevId));
  468.                  InsertListItem (LI_OPENINST,LIT_END,buffer);
  469.               }
  470.           }
  471.         /* Begin Insertion of Open Device Alias(es) into the list box */
  472.  
  473.         for (i= 0; i < MAXOPENS; i++)
  474.           {
  475.              if (strlen(SpyBlock.OpenList.szAlias[i].szAlias) != 0)
  476.               {
  477.                  strcpy (buffer,
  478.                          (char *)LongToString(SpyBlock.OpenList.szAlias[i].ulPID));
  479.                  strcat (buffer,"     ");
  480.                  strcat (buffer,SpyBlock.OpenList.szAlias[i].szAlias);
  481.                  InsertListItem (LI_OPENINST,LIT_END,buffer);
  482.               }
  483.           }
  484.  
  485.         /* Identify The current Device Id Filters If any and Select them */
  486.  
  487.         for (i= 0; i < MAXOPENS; i++)
  488.           {
  489.              if (SpyBlock.OpenList.ulOpenList[i].fExclude)
  490.                  WinSendDlgItemMsg(hwnd,LI_OPENINST,LM_SELECTITEM,
  491.                                    MPFROMSHORT(i),MPFROMSHORT(TRUE));
  492.           }
  493.  
  494.         /* Identify The current Device Alias(es)
  495.         **  Filters If any and Select them .
  496.         */
  497.  
  498.         for (i= 0; i < MAXOPENS; i++)
  499.           {
  500.              if (SpyBlock.OpenList.szAlias[i].fExclude)
  501.                  WinSendDlgItemMsg(hwnd,LI_OPENINST,LM_SELECTITEM,
  502.                                    MPFROMSHORT(i),MPFROMSHORT(TRUE));
  503.           }
  504.  
  505.         break;
  506.  
  507.     case WM_PAINT:
  508.  
  509.           /* Execute default processing */
  510.          return(WinDefDlgProc(hwnd,msg,mp1,mp2));
  511.        break;
  512.  
  513.     default:
  514.       return(WinDefDlgProc(hwnd,msg,mp1,mp2));
  515.   }
  516.     return(FALSE);
  517. }
  518.  
  519. /****************************START OF SPECIFICATIONS *************************
  520. *
  521. * FUNCTION:   AboutDlgProc
  522. *
  523. * ARGUMENTS:  HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2
  524. *
  525. * RETURN: None
  526. *
  527. * DESCRIPTION: This routine brings up the dialog about.
  528. *
  529. *****************************END OF SPECIFICATIONS ***************************/
  530.  
  531. MRESULT EXPENTRY AboutDlgProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
  532. {
  533.   switch(msg)
  534.     {
  535.     case WM_CONTROL:
  536.       if ( SHORT2FROMMP ( mp1 ) ==  LN_ENTER )
  537.             WinSendMsg ( hwnd, WM_COMMAND, MPFROMSHORT ( PB_OK ),
  538.                       MPFROM2SHORT ( CMDSRC_PUSHBUTTON, TRUE ) );
  539.       break;
  540.  
  541.     case WM_COMMAND:
  542.       switch (SHORT1FROMMP(mp1))
  543.         {
  544.         case PB_OK:
  545.           WinDismissDlg (hwnd,PB_OK);
  546.          break;
  547.         }
  548.         break;
  549.  
  550.     case WM_PAINT:
  551.         /* Execute default processing */
  552.          return(WinDefDlgProc(hwnd,msg,mp1,mp2));
  553.         break;
  554.     default:
  555.         return(WinDefDlgProc(hwnd,msg,mp1,mp2));
  556.     }
  557.     return(FALSE);
  558. }
  559.  
  560. /****************************START OF SPECIFICATIONS *************************
  561. *
  562. * FUNCTION:   FilterDevTypDlgProc
  563. *
  564. * ARGUMENTS:  HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2
  565. *
  566. * RETURN:     None
  567. *
  568. * DESCRIPTION: Message Filters Dialog  Procedure
  569. *
  570. * OS/2 API's USED: None
  571. *
  572. *****************************END OF SPECIFICATIONS ***************************/
  573. MRESULT EXPENTRY ShowFlagDlgProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
  574. {
  575.   typedef struct _flagTable{
  576.     USHORT    wMsg;
  577.     SZ      szFlag[100];
  578.     ULONG   dwFlag;
  579.   }MCIFlagTbl;
  580.  
  581.   SHORT  sDataIndex;              /* Data Item Index   */
  582.   RC     ReturnCode;              /* API Return Code   */
  583.   static ULONG  dwFlag = 0;       /* Local Flag        */
  584.   USHORT i,j;                     /* Loop Indices      */
  585.   USHORT   wMsg;                  /* Local MCI Msg     */
  586.   SZ     szTemp[10];              /* Temporary buffer  */
  587.   SZ     szFontName[70];          /* Font Name Array   */
  588.   SZ     TempBuffer[80];          /* Temporary buffer  */
  589.   SZ     TokenSep[]=" \t";        /* Token Seperator   */
  590.   PCHAR  pchWord;                 /* Temporary buffer  */
  591.   PCHAR  stop;                    /* Temporary buffer  */
  592.   BOOL   fCommon = FALSE;         /* Found Common Flag */
  593.   BOOL   fMsg    = FALSE;         /* Found Msg         */
  594.  
  595.   MCIFlagTbl MCIFlagsTbl[]={
  596.   0,  "MCI_NOTIFY",                                         0x00000001L,
  597.   0,  "MCI_WAIT",                                           0x00000002L,
  598.   0,  "MCI_FROM",                                           0x00000004L,
  599.   0,  "MCI_TO",                                             0x00000008L,
  600.   0,  "MCI_MILLISECONDS",                                   0x00000010L,
  601.   0,  "MCI_TRACK",                                          0x00000020L,
  602.   0,  "MCI_OVER",                                           0x00000040L,
  603.   0,  "MCI_TEST",                                           0x00000080L,
  604.   0,  "MCI_TO_BUFFER",                                      0x00000100L,
  605.   0,  "MCI_FROM_BUFFER",                                    0x00000200L,
  606.   0,  "MCI_CONVERT_FORMAT",                                 0x00000400L,
  607.   MCI_ACQUIREDEVICE, "MCI_EXCLUSIVE",                       0x00000100L,
  608.   MCI_ACQUIREDEVICE, "MCI_EXCLUSIVE_INSTANCE",              0x00000200L,
  609.   MCI_ACQUIREDEVICE, "MCI_ACQUIRE_QUEUE",                   0x00000400L,
  610.   MCI_CAPTURE,       "MCI_CAPTURE_RECT",                    0x00000100L,
  611.   MCI_CAPTURE,        "MCI_CONVERT",                        0x00001000L,
  612.   MCI_CONNECTION,  "MCI_ENABLE_CONNECTOR",                  0x00000100L,
  613.   MCI_CONNECTION,  "MCI_DISABLE_CONNECTOR",                 0x00000200L,
  614.   MCI_CONNECTION,  "MCI_QUERY_CONNECTOR_STATUS",            0x00000400L,
  615.   MCI_CONNECTION,  "MCI_CONNECTOR_TYPE",                    0x00000800L,
  616.   MCI_CONNECTION,  "MCI_CONNECTOR_INDEX",                   0x00001000L,
  617.   MCI_CONNECTION,  "MCI_TO_CONNECTOR_INDEX",                0x00002000L,
  618.   MCI_CONNECTION,  "MCI_TO_CONNECTOR_TYPE",                 0x00004000L,
  619.   MCI_CONNECTION,  "MCI_QUERY_CONNECTION",                   0x00008000L,
  620.   MCI_CONNECTION,  "MCI_MAKE_CONNECTION",                    0x00010000L,
  621.   MCI_CONNECTION,  "MCI_BREAK_CONNECTION",                   0x00020000L,
  622.   MCI_CONNECTION,  "MCI_ENUMERATE_CONNECTORS",               0x00040000L,
  623.   MCI_CONNECTION,  "MCI_QUERY_CONNECTOR_TYPE",               0x00080000L,
  624.   MCI_CONNECTION,  "MCI_QUERY_VALID_CONNECTION",             0x00100000L,
  625.   MCI_CONNECTION,  "MCI_CONNECTOR_ALIAS",                    0x00200000L,
  626.   MCI_CUE,         "MCI_CUE_INPUT",                         0x00000100L,
  627.   MCI_CUE,         "MCI_CUE_OUTPUT",                        0x00000200L,
  628.   MCI_CUE,         "MCI_WAVE_INPUT",                        0x00001000L,
  629.   MCI_CUE,         "MCI_WAVE_OUTPUT",                       0x00002000L,
  630.   MCI_ESCAPE,      "MCI_ESCAPE_STRING",                     0x00000100L,
  631.   MCI_FREEZE,      "MCI_OVLY_FREEZE_RECT",                  0x00000100L,
  632.   MCI_FREEZE,      "MCI_OVLY_FREEZE_RECT_OUTSIDE",          0x00000200L,
  633.   MCI_GETDEVCAPS,  "MCI_GETDEVCAPS_MESSAGE",                0x00000100L,
  634.   MCI_GETDEVCAPS,  "MCI_GETDEVCAPS_ITEM",                   0x00000200L,
  635.   MCI_GETDEVCAPS,  "MCI_GETDEVCAPS_EXTENDED",               0x00000400L,
  636.   MCI_MASTERAUDIO, "MCI_ON",                                0x00000100L,
  637.   MCI_MASTERAUDIO, "MCI_OFF",                               0x00000200L,
  638.   MCI_MASTERAUDIO, "MCI_HEADPHONES",                        0x00000400L,
  639.   MCI_MASTERAUDIO, "MCI_SPEAKERS",                          0x00000800L,
  640.   MCI_MASTERAUDIO, "MCI_MASTERVOL",                         0x00001000L,
  641.   MCI_MASTERAUDIO, "MCI_SAVESETTING",                       0x00002000L,
  642.   MCI_MASTERAUDIO, "MCI_QUERYSAVEDSETTING",                 0x00004000L,
  643.   MCI_MASTERAUDIO, "MCI_QUERYCURRENTSETTING",               0x00008000L,
  644.   MCI_INFO,        "MCI_INFO_PRODUCT",                      0x00000100L,
  645.   MCI_INFO,        "MCI_INFO_FILE",                         0x00000200L,
  646.   MCI_OPEN,        "MCI_OPEN_ELEMENT",                      0x00000100L,
  647.   MCI_OPEN,        "MCI_OPEN_ALIAS",                        0x00000200L,
  648.   MCI_OPEN,        "MCI_OPEN_ELEMENT_ID",                   0x00000400L,
  649.   MCI_OPEN,        "MCI_OPEN_PLAYLIST",                     0x00000800L,
  650.   MCI_OPEN,        "MCI_OPEN_TYPE_ID",                      0x00001000L,
  651.   MCI_OPEN,        "MCI_OPEN_SHAREABLE",                    0x00002000L,
  652.   MCI_OPEN,        "MCI_OPEN_MMIO",                         0x00004000L,
  653.   MCI_OPEN,        "MCI_READONLY",                          0x00008000L,
  654.   MCI_OPEN,        "MCI_VID_OPEN_PARENT",                   0x01000000L,
  655.   MCI_SYSINFO,      "MCI_SYSINFO_QUANTITY",                0x00000100L,
  656.   MCI_SYSINFO,      "MCI_SYSINFO_OPEN",                    0x00000200L,
  657.   MCI_SYSINFO,      "MCI_SYSINFO_NAME",                    0x00000400L,
  658.   MCI_SYSINFO,      "MCI_SYSINFO_INSTALLNAME",             0x00000800L,
  659.   MCI_SYSINFO,      "MCI_SYSINFO_ITEM",                    0x00001000L,
  660.   MCI_SYSINFO,      "MCI_SYSINFO_INI_LOCK",                0x00002000L,
  661.   MCI_PLAY,         "MCI_VD_PLAY_REVERSE",                 0x00001000L,
  662.   MCI_PLAY,         "MCI_VD_PLAY_FAST",                    0x00002000L,
  663.   MCI_PLAY,         "MCI_VD_PLAY_SPEED",                   0x00004000L,
  664.   MCI_PLAY,         "MCI_VD_PLAY_SCAN",                    0x00008000L,
  665.   MCI_PLAY,         "MCI_VD_PLAY_SLOW",                    0x00010000L,
  666.   MCI_PLAY,         "MCI_FROM",                            0x00000004L,
  667.   MCI_PLAY,         "MCI_TO",                              0x00000008L,
  668.   MCI_RECORD,        "MCI_RECORD_INSERT",                   0x00000100L,
  669.   MCI_RECORD,        "MCI_RECORD_OVERWRITE",                0x00000200L,
  670.   MCI_SAVE,          "MCI_SAVE_FILE",                       0x00000100L,
  671.   MCI_SAVE,          "MCI_DGV_SAVE_VIDEO_FILE",             0x00001000L,
  672.   MCI_SAVE,          "MCI_DGV_SAVE_IMAGE_FILE",             0x00002000L,
  673.   MCI_SEEK,          "MCI_TO_START",                        0x00000100L,
  674.   MCI_SEEK,          "MCI_TO_END",                          0x00000200L,
  675.   MCI_SEEK,          "MCI_DGV_SEEK_TO_NEAREST_IFRAME",      0x00100000L,
  676.   MCI_SET,           "MCI_SET_ITEM",                        0x00000100L,
  677.   MCI_SET,           "MCI_SET_ON",                          0x00000200L,
  678.   MCI_SET,           "MCI_SET_OFF",                         0x00000400L,
  679.   MCI_SET,           "MCI_SET_VIDEO",                       0x00000800L,
  680.   MCI_SET,           "MCI_SET_AUDIO",                       0x00001000L,
  681.   MCI_SET,           "MCI_SET_DOOR_OPEN",                   0x00002000L,
  682.   MCI_SET,           "MCI_SET_DOOR_CLOSED",                 0x00004000L,
  683.   MCI_SET,           "MCI_SET_SPEED_FORMAT",                0x00008000L,
  684.   MCI_SET,           "MCI_SET_TIME_FORMAT",                 0x00010000L,
  685.   MCI_SET,           "MCI_SET_DOOR_LOCK",                   0x00020000L,
  686.   MCI_SET,           "MCI_SET_DOOR_UNLOCK",                 0x00040000L,
  687.   MCI_SET,           "MCI_SET_VOLUME",                      0x00080000L,
  688.   MCI_SET,           "MCI_SET_ITEM_FOURCC",                 0x00100000L,
  689.   MCI_SET,           "MCI_SET_REVERSE",                     0x00200000L
  690.  
  691.   };
  692.  
  693.  
  694.   switch(msg)
  695.     {
  696.     case WM_CONTROL:
  697.       break;
  698.  
  699.     case WM_COMMAND:
  700.       switch (SHORT1FROMMP(mp1))
  701.         {
  702.         case PB_OK:
  703.  
  704.            if (!(BOOL)WinSendMsg( WinWindowFromID(hwnd,EF_FLAG),
  705.                                   EM_QUERYCHANGED,(MPARAM)0L,
  706.                                   (MPARAM) 0L ))
  707.             {
  708.                if (dwFlag == 0)
  709.                 {
  710.                    mprintf ("No Flag Value entered \n");
  711.                    break;
  712.                 }
  713.             }
  714.  
  715.           WinQueryWindowText ( WinWindowFromID(hwnd,EF_FLAG),
  716.                              9, szTemp );
  717.  
  718.           dwFlag = strtol (szTemp,&stop,16);
  719.  
  720.           if ( dwFlag > 0x01111111L )
  721.            {
  722.                mprintf ("Flag Value out of Range \n");
  723.                break;
  724.            }
  725.  
  726.           sDataIndex = SHORT1FROMMR( WinSendDlgItemMsg( hwnd,LI_MSGS,
  727.                                         LM_QUERYSELECTION,(MPARAM)LIT_FIRST,
  728.                                         (MPARAM) 0L ) );
  729.  
  730.           if (sDataIndex == LIT_NONE)
  731.            {
  732.              mprintf ("No MCI Message Selected\n");
  733.              break;
  734.            }
  735.  
  736.           WinSendDlgItemMsg( hwnd, LI_MSGS, LM_QUERYITEMTEXT,
  737.                              MPFROM2SHORT(sDataIndex,80), TempBuffer );
  738.  
  739.           pchWord = strtok (TempBuffer,TokenSep);
  740.           /*
  741.           ** Find this message in our global message table and
  742.           */
  743.           for (i=0; i <MAX_MCI_MSGS; i++)
  744.             {
  745.               if (strcmp (MCIMsgTbl[i].szMessage,pchWord) == 0)
  746.                {
  747.                  wMsg = MCIMsgTbl[i].usMsg;
  748.                  fMsg = TRUE;
  749.                  break;
  750.                }
  751.             }
  752.          if (!fMsg)
  753.           {
  754.             mprintf ("Could not Find Message %s\n",pchWord);
  755.             break;
  756.           }
  757.          for (i= 0; i < 92; i++)
  758.            {
  759.              if (i < NUM_COMMON_FLAGS )
  760.               {
  761.                 if (!fCommon)
  762.                  {
  763.                     if (dwFlag & MCIFlagsTbl[i].dwFlag)
  764.                      {
  765.                         InsertListItem (LI_FLAGS,LIT_SORTASCENDING,MCIFlagsTbl[i].szFlag);
  766.                         fCommon = TRUE;
  767.                      }
  768.                  }
  769.               }
  770.              if (wMsg == MCIFlagsTbl[i].wMsg)
  771.               {
  772.                 if (dwFlag & MCIFlagsTbl[i].dwFlag)
  773.                  {
  774.                     InsertListItem (LI_FLAGS,LIT_SORTASCENDING,MCIFlagsTbl[i].szFlag);
  775.                     fCommon = TRUE;
  776.                  }
  777.               }
  778.            }
  779.            if (!fCommon)
  780.               mprintf ("Unknown Flag (Modify Source Provided) %d\n",dwFlag);
  781.  
  782.           break;
  783.  
  784.           case DID_CANCEL:
  785.               /* Dismiss the dialog box */
  786.               WinDismissDlg (hwnd,DID_CANCEL);
  787.           break;
  788.  
  789.         case PB_HELP:
  790.           if ( SpyBlock.hwndHelpInstance )
  791.               WinSendMsg (SpyBlock.hwndHelpInstance, HM_DISPLAY_HELP,
  792.                       MPFROM2SHORT(SHOWFLAGHLP, NULL),
  793.                       MPFROMSHORT(HM_RESOURCEID));
  794.          break;
  795.  
  796.         case PB_CLEAR:
  797.              WinSendDlgItemMsg (hwnd,LI_FLAGS,LM_DELETEALL,(MPARAM)0,(MPARAM)0);
  798.          break;
  799.         }
  800.       break;
  801.  
  802.       case WM_INITDLG:
  803.            /* Max no. of chars for Device Names list is 512 */
  804.            WinSendDlgItemMsg(hwnd,LI_MSGS,EM_SETTEXTLIMIT,
  805.                              MPFROMSHORT(8192),0L);
  806.  
  807.  
  808.            strcpy (szFontName,"10.System Monospaced");
  809.            WinSetPresParam (hwnd,PP_FONTNAMESIZE,
  810.                             (ULONG)((ULONG) strlen(szFontName)+(ULONG)1),
  811.                             (PSZ) szFontName);
  812.  
  813.            /* Max no. of chars for Device Names list is 512 */
  814.  
  815.            WinSendDlgItemMsg(hwnd,LI_FLAGS,EM_SETTEXTLIMIT,
  816.                              MPFROMSHORT(8192),0L);
  817.  
  818.  
  819.            for (i=0; i < MAX_MCI_MSGS; i++)
  820.              {
  821.                 for (j=0; j < 90 ; j++)
  822.                   {
  823.                     if (MCIFlagsTbl[j].wMsg == MCIMsgTbl[i].usMsg)
  824.                      {
  825.                          InsertListItem (LI_MSGS,
  826.                                          LIT_SORTASCENDING,MCIMsgTbl[i].szMessage);
  827.                          break;
  828.                      }
  829.                   }
  830.              }
  831.  
  832.            break;
  833.  
  834.       case WM_PAINT:
  835.  
  836.           /* Execute default processing */
  837.            return(WinDefDlgProc(hwnd,msg,mp1,mp2));
  838.  
  839.         break;
  840.  
  841.       default:
  842.           return(WinDefDlgProc(hwnd,msg,mp1,mp2));
  843.   }
  844.     return(FALSE);
  845. }
  846.  
  847. /****************************START OF SPECIFICATIONS *************************
  848. *
  849. * FUNCTION:   FilterMsgDlgProc
  850. *
  851. * ARGUMENTS:  HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2
  852. *
  853. * RETURN:     None
  854. *
  855. * DESCRIPTION: Message Filters Dialog  Procedure
  856. *
  857. * OS/2 API's USED: None
  858. *
  859. * C FUNCTION CALLS: memset
  860. *
  861. *****************************END OF SPECIFICATIONS ***************************/
  862.  
  863. MRESULT EXPENTRY FilterMsgDlgProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
  864. {
  865.  
  866.   SHORT  sDataIndex;              /* Data Item Index   */
  867.   RC     ReturnCode;              /* API Return Code   */
  868.   PCHAR  pchWord;                 /* Temporary pointer */
  869.   SZ     szFontName[60];          /* FontName Array    */
  870.   ULONG  ulCount;                 /* Items Selected    */
  871.   USHORT usIndex,i,j = 0;         /* Loop Indices      */
  872.   SZ     TempBuffer[124];         /* Item text buffer  */
  873.   SZ     TokenSep[]=" \t";        /* Token Seperator   */
  874.  
  875.   switch(msg)
  876.     {
  877.     case WM_CONTROL:
  878.      break;
  879.  
  880.     case WM_COMMAND:
  881.       switch (SHORT1FROMMP(mp1))
  882.         {
  883.         case PB_OK:
  884.           ulCount = 0L;
  885.           sDataIndex = 0;
  886.  
  887.           /* Reset All the previous filter flags */
  888.           for (i=0; i < MAX_MCI_MSGS; i++)
  889.             {
  890.               MCIMsgTbl[i].fExclude = FALSE;
  891.             }
  892.  
  893.           sDataIndex = SHORT1FROMMR( WinSendDlgItemMsg( hwnd,LI_FILTERMSG,
  894.                                       LM_QUERYSELECTION,(MPARAM)LIT_FIRST,
  895.                                       (MPARAM) 0L ) );
  896.  
  897.           if (sDataIndex != LIT_NONE)
  898.            {
  899.               WinSendDlgItemMsg( hwnd, LI_FILTERMSG, LM_QUERYITEMTEXT,
  900.                                  MPFROM2SHORT(sDataIndex,80), TempBuffer );
  901.  
  902.               pchWord = strtok (TempBuffer,TokenSep);
  903.               /*
  904.               ** Find this message in our global message table and
  905.               ** Toggle the filter status to "include". Note that we
  906.               ** Don't care what the previous state was. We always
  907.               ** update the status to reflect current action.
  908.               */
  909.               for (i=0; i <MAX_MCI_MSGS; i++)
  910.                 {
  911.                  if (strcmp (MCIMsgTbl[i].szMessage,pchWord) == 0)
  912.                   {
  913.                      MCIMsgTbl[i].fExclude = TRUE;
  914.                      break;
  915.                   }
  916.                 }
  917.               while (sDataIndex != LIT_NONE)
  918.                 {
  919.                   ulCount++;
  920.                   sDataIndex = SHORT1FROMMR( WinSendDlgItemMsg( hwnd,LI_FILTERMSG,
  921.                                                 LM_QUERYSELECTION,(MPARAM)sDataIndex,
  922.                                                 (MPARAM) 0L ) );
  923.                   if (sDataIndex != LIT_NONE)
  924.                    {
  925.                       WinSendDlgItemMsg( hwnd, LI_FILTERMSG, LM_QUERYITEMTEXT,
  926.                                          MPFROM2SHORT(sDataIndex,80), TempBuffer );
  927.  
  928.                       pchWord = strtok (TempBuffer,TokenSep);
  929.  
  930.                       /*
  931.                       ** Find this message in our global message table and
  932.                       ** Toggle the filter status to "include". Note that we
  933.                       ** Don't care what the previous state was. We always
  934.                       ** update the status to reflect current action.
  935.                       */
  936.  
  937.                       for (i=0; i <MAX_MCI_MSGS; i++)
  938.                         {
  939.                          if (strcmp (MCIMsgTbl[i].szMessage,pchWord) == 0)
  940.                           {
  941.                              MCIMsgTbl[i].fExclude = TRUE;
  942.                              break;
  943.                           } /* Found it */
  944.                         } /* For Loop */
  945.                    } /* LIT_NONE */
  946.                 } /* While */
  947.            } /* No Selection */
  948.           WinDismissDlg (hwnd,PB_OK);
  949.          break;
  950.  
  951.         case PB_ALL:
  952.  
  953.           for (i=0; i < MAX_MCI_MSGS; i++)
  954.             {
  955.                /* Select all items in the list  */
  956.  
  957.                WinSendDlgItemMsg(hwnd,LI_FILTERMSG,LM_SELECTITEM,
  958.                                  MPFROMSHORT(i),MPFROMSHORT(TRUE));
  959.  
  960.               MCIMsgTbl[i].fExclude = TRUE;
  961.             }
  962.          break;
  963.  
  964.         case PB_NONE:
  965.  
  966.           /* DeSelect all items in the list */
  967.  
  968.           WinSendDlgItemMsg(hwnd,LI_FILTERMSG,LM_SELECTITEM,
  969.                             MPFROMSHORT(LIT_NONE),0L);
  970.  
  971.           for (i=0; i < MAX_MCI_MSGS; i++)
  972.             {
  973.               MCIMsgTbl[i].fExclude = FALSE;
  974.             }
  975.  
  976.          break;
  977.  
  978.         case PB_TIMERON:
  979.  
  980.           for (i=0; i < MAX_MCI_MSGS; i++)
  981.             {
  982.                if (MCIMsgTbl[i].usMsg ==MM_MCIPOSITIONCHANGE )
  983.                 {
  984.                    /* Select  item in the list  */
  985.  
  986.                    WinSendDlgItemMsg(hwnd,LI_FILTERMSG,LM_SELECTITEM,
  987.                                      MPFROMSHORT(i),MPFROMSHORT(TRUE));
  988.                   MCIMsgTbl[i].fExclude = TRUE;
  989.                 }
  990.             }
  991.          break;
  992.  
  993.         case PB_TIMEROFF:
  994.           for (i=0; i < MAX_MCI_MSGS; i++)
  995.             {
  996.                if (MCIMsgTbl[i].usMsg == MM_MCIPOSITIONCHANGE)
  997.                 {
  998.                    /* Select  item in the list  */
  999.  
  1000.                    WinSendDlgItemMsg(hwnd,LI_FILTERMSG,LM_SELECTITEM,
  1001.                                      MPFROMSHORT(i),MPFROMSHORT(FALSE));
  1002.  
  1003.                   MCIMsgTbl[i].fExclude = FALSE;
  1004.                 }
  1005.             }
  1006.          break;
  1007.  
  1008.         case PB_ACTON:
  1009.           for (i=0; i < MAX_MCI_MSGS; i++)
  1010.             {
  1011.  
  1012.                if ((MCIMsgTbl[i].usMsg == MCI_PLAY) ||
  1013.                   (MCIMsgTbl[i].usMsg == MCI_PAUSE) ||
  1014.                   (MCIMsgTbl[i].usMsg == MCI_RECORD) ||
  1015.                   (MCIMsgTbl[i].usMsg == MCI_RESUME) ||
  1016.                   (MCIMsgTbl[i].usMsg == MCI_SEEK) ||
  1017.                   (MCIMsgTbl[i].usMsg == MCI_STOP) ||
  1018.                   (MCIMsgTbl[i].usMsg == MCI_CUE) ||
  1019.                   (MCIMsgTbl[i].usMsg == MCI_STEP) ||
  1020.                   (MCIMsgTbl[i].usMsg == MCI_SPIN) ||
  1021.                   (MCIMsgTbl[i].usMsg == MCI_REWIND))
  1022.  
  1023.                 {
  1024.                    /* Select  item in the list  */
  1025.  
  1026.                   WinSendDlgItemMsg(hwnd,LI_FILTERMSG,LM_SELECTITEM,
  1027.                                     MPFROMSHORT(i),MPFROMSHORT(TRUE));
  1028.                   MCIMsgTbl[i].fExclude = TRUE;
  1029.                 }
  1030.             }
  1031.          break;
  1032.  
  1033.         case PB_ACTOFF:
  1034.           for (i=0; i < MAX_MCI_MSGS; i++)
  1035.             {
  1036.                if ((MCIMsgTbl[i].usMsg == MCI_PLAY) ||
  1037.                   (MCIMsgTbl[i].usMsg == MCI_PAUSE) ||
  1038.                   (MCIMsgTbl[i].usMsg == MCI_RECORD) ||
  1039.                   (MCIMsgTbl[i].usMsg == MCI_RESUME) ||
  1040.                   (MCIMsgTbl[i].usMsg == MCI_SEEK) ||
  1041.                   (MCIMsgTbl[i].usMsg == MCI_STOP) ||
  1042.                   (MCIMsgTbl[i].usMsg == MCI_CUE) ||
  1043.                   (MCIMsgTbl[i].usMsg == MCI_STEP) ||
  1044.                   (MCIMsgTbl[i].usMsg == MCI_SPIN) ||
  1045.                   (MCIMsgTbl[i].usMsg == MCI_REWIND))
  1046.  
  1047.                 {
  1048.                    /* Select  item in the list  */
  1049.  
  1050.                   WinSendDlgItemMsg(hwnd,LI_FILTERMSG,LM_SELECTITEM,
  1051.                                     MPFROMSHORT(i),MPFROMSHORT(FALSE));
  1052.                   MCIMsgTbl[i].fExclude = FALSE;
  1053.                 }
  1054.             }
  1055.          break;
  1056.  
  1057.  
  1058.         case DID_CANCEL:
  1059.           /* Dismiss the dialog box */
  1060.           WinDismissDlg (hwnd,DID_CANCEL);
  1061.           break;
  1062.  
  1063.         case PB_HELP:
  1064.          if ( SpyBlock.hwndHelpInstance )
  1065.              WinSendMsg (SpyBlock.hwndHelpInstance, HM_DISPLAY_HELP,
  1066.                      MPFROM2SHORT(FILTERMSGHLP, NULL),
  1067.                      MPFROMSHORT(HM_RESOURCEID));
  1068.          break;
  1069.         }
  1070.      break;
  1071.  
  1072.     case WM_INITDLG:
  1073.       /* Max no. of chars for Device Names list is 512 */
  1074.       WinSendDlgItemMsg(hwnd,LI_FILTERMSG,EM_SETTEXTLIMIT,
  1075.                         MPFROMSHORT(16654),0L);
  1076.  
  1077.  
  1078.       strcpy (szFontName,"10.System Monospaced");
  1079.       WinSetPresParam (hwnd,PP_FONTNAMESIZE,
  1080.                        (ULONG)(strlen(szFontName)+(ULONG)1),
  1081.                        (PSZ) szFontName);
  1082.  
  1083.       for (i=0; i < MAX_MCI_MSGS; i++)
  1084.         {
  1085.            InsertListItem (LI_FILTERMSG,
  1086.                            LIT_SORTASCENDING,MCIMsgTbl[i].szMessage);
  1087.         }
  1088.       for (i=0; i < MAX_MCI_MSGS; i++)
  1089.         {
  1090.            if (MCIMsgTbl[i].fExclude)
  1091.                WinSendDlgItemMsg(hwnd,LI_FILTERMSG,LM_SELECTITEM,
  1092.                                  MPFROMSHORT(i),MPFROMSHORT(TRUE));
  1093.         }
  1094.  
  1095.      break;
  1096.  
  1097.     case WM_PAINT:
  1098.  
  1099.       /* Execute default processing */
  1100.  
  1101.       return(WinDefDlgProc(hwnd,msg,mp1,mp2));
  1102.      break;
  1103.  
  1104.     default:
  1105.         return(WinDefDlgProc(hwnd,msg,mp1,mp2));
  1106.   }
  1107.     return(FALSE);
  1108. }
  1109.  
  1110.