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 / aasysinf.c < prev    next >
C/C++ Source or Header  |  1997-10-05  |  6KB  |  212 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. //  aasysinf.c
  12. //
  13. //  Description:
  14. //      Respond to the View/System Information menu item - display info on
  15. //      the user's system and the ACM.
  16. //
  17. //
  18. //==========================================================================;
  19.  
  20. #include <windows.h>
  21. #include <windowsx.h>
  22. #include <mmsystem.h>
  23. #include <memory.h>
  24.  
  25. #include <mmreg.h>
  26. #include <msacm.h>
  27.  
  28. #include "appport.h"
  29. #include "acmapp.h"
  30.  
  31. #include "debug.h"
  32.  
  33.  
  34. //--------------------------------------------------------------------------;
  35. //  
  36. //  BOOL AcmAppDisplaySystemInfo
  37. //  
  38. //  Description:
  39. //  
  40. //  
  41. //  Arguments:
  42. //      HWND hedit:
  43. //  
  44. //  Return (BOOL):
  45. //  
  46. //  
  47. //--------------------------------------------------------------------------;
  48.  
  49. BOOL FNLOCAL AcmAppDisplaySystemInfo
  50. (
  51.     HWND            hedit
  52. )
  53. {
  54.     static TCHAR    szDisplayTitle[]  = TEXT("[System Information]\r\n");
  55.  
  56.     DWORD       dw;
  57.  
  58.     //
  59.     //
  60.     //
  61.     MEditPrintF(hedit, szDisplayTitle);
  62.  
  63.     //
  64.     //
  65.     //
  66.     dw = GetVersion();
  67.     MEditPrintF(hedit, TEXT("%23s: %u.%.02u"),
  68. #ifdef WIN32
  69.                     (LPTSTR)TEXT("WinMM Version"),
  70. #else
  71.                     (LPTSTR)TEXT("MMSystem Version"),
  72. #endif
  73.                     HIWORD(dw), LOWORD(dw));
  74.  
  75.     //
  76.     //
  77.     //
  78.     MEditPrintF(hedit, TEXT("~%23s: "), (LPTSTR)TEXT("ACM Version"));
  79.     dw = acmGetVersion();
  80.     if (0L == dw)
  81.     {
  82.         MEditPrintF(hedit, TEXT("Not Installed"));
  83.         return (TRUE);
  84.     }
  85.  
  86.     //
  87.     //  if the 'build' number is zero, it is a _retail_ version of the
  88.     //  ACM that is installed. if it is non-zero, it is the debug version.
  89.     //
  90.     if (0 == LOWORD(dw))
  91.     {
  92.         MEditPrintF(hedit, TEXT("%u.%.02u (retail)"),
  93.                         HIWORD(dw) >> 8, HIWORD(dw) & 0x00FF);
  94.     }
  95.     else
  96.     {
  97.         MEditPrintF(hedit, TEXT("%u.%.02u (debug build %u)"),
  98.                         HIWORD(dw) >> 8, HIWORD(dw) & 0x00FF, LOWORD(dw));
  99.     }
  100.  
  101.     //
  102.     //
  103.     //
  104.     acmMetrics(NULL, ACM_METRIC_COUNT_DRIVERS, &dw);
  105.     MEditPrintF(hedit, TEXT("\r\n%23s: %lu"), (LPTSTR)TEXT("Enabled Drivers"), dw);
  106.     
  107.     acmMetrics(NULL, ACM_METRIC_COUNT_DISABLED, &dw);
  108.     MEditPrintF(hedit, TEXT("%23s: %lu"), (LPTSTR)TEXT("Disabled Drivers"), dw);
  109.  
  110.     acmMetrics(NULL, ACM_METRIC_COUNT_CODECS, &dw);
  111.     MEditPrintF(hedit, TEXT("%23s: %lu"), (LPTSTR)TEXT("Total CODEC's"), dw);
  112.  
  113.     acmMetrics(NULL, ACM_METRIC_COUNT_CONVERTERS, &dw);
  114.     MEditPrintF(hedit, TEXT("%23s: %lu"), (LPTSTR)TEXT("Total Converters"), dw);
  115.  
  116.     acmMetrics(NULL, ACM_METRIC_COUNT_FILTERS, &dw);
  117.     MEditPrintF(hedit, TEXT("%23s: %lu"), (LPTSTR)TEXT("Total Filters"), dw);
  118.  
  119.     acmMetrics(NULL, ACM_METRIC_COUNT_HARDWARE, &dw);
  120.     MEditPrintF(hedit, TEXT("%23s: %lu"), (LPTSTR)TEXT("Hardware Drivers"), dw);
  121.  
  122.  
  123.     acmMetrics(NULL, ACM_METRIC_COUNT_LOCAL_DRIVERS, &dw);
  124.     MEditPrintF(hedit, TEXT("\r\n%23s: %lu"), (LPTSTR)TEXT("Enabled Local Drivers"), dw);
  125.     
  126.     acmMetrics(NULL, ACM_METRIC_COUNT_LOCAL_DISABLED, &dw);
  127.     MEditPrintF(hedit, TEXT("%23s: %lu"), (LPTSTR)TEXT("Disabled Local Drivers"), dw);
  128.  
  129.     acmMetrics(NULL, ACM_METRIC_COUNT_LOCAL_CODECS, &dw);
  130.     MEditPrintF(hedit, TEXT("%23s: %lu"), (LPTSTR)TEXT("Total Local CODEC's"), dw);
  131.  
  132.     acmMetrics(NULL, ACM_METRIC_COUNT_LOCAL_CONVERTERS, &dw);
  133.     MEditPrintF(hedit, TEXT("%23s: %lu"), (LPTSTR)TEXT("Total Local Converters"), dw);
  134.  
  135.     acmMetrics(NULL, ACM_METRIC_COUNT_LOCAL_FILTERS, &dw);
  136.     MEditPrintF(hedit, TEXT("%23s: %lu"), (LPTSTR)TEXT("Total Local Filters"), dw);
  137.  
  138.  
  139.     acmMetrics(NULL, ACM_METRIC_MAX_SIZE_FORMAT, &dw);
  140.     MEditPrintF(hedit, TEXT("\r\n%23s: %lu"), (LPTSTR)TEXT("Max Format Bytes"), dw);
  141.  
  142.     acmMetrics(NULL, ACM_METRIC_MAX_SIZE_FILTER, &dw);
  143.     MEditPrintF(hedit, TEXT("%23s: %lu"), (LPTSTR)TEXT("Max Filter Bytes"), dw);
  144.  
  145.     return (TRUE);
  146. } // AcmAppDisplaySystemInfo()
  147.  
  148.  
  149. //--------------------------------------------------------------------------;
  150. //  
  151. //  BOOL AcmAppSystemInfoDlgProc
  152. //  
  153. //  Description:
  154. //  
  155. //  
  156. //  Arguments:
  157. //      HWND hwnd:
  158. //  
  159. //      UINT uMsg:
  160. //  
  161. //      WPARAM wParam:
  162. //  
  163. //      LPARAM lParam:
  164. //  
  165. //  Return (BOOL):
  166. //  
  167. //--------------------------------------------------------------------------;
  168.  
  169. BOOL FNEXPORT AcmAppSystemInfoDlgProc
  170. (
  171.     HWND                    hwnd,
  172.     UINT                    uMsg,
  173.     WPARAM                  wParam,
  174.     LPARAM                  lParam
  175. )
  176. {
  177.     HWND                hedit;
  178.     UINT                uId;
  179.  
  180.     switch (uMsg)
  181.     {
  182.         case WM_INITDIALOG:
  183.             hedit = GetDlgItem(hwnd, IDD_AADETAILS_EDIT_DETAILS);
  184.             SetWindowFont(hedit, ghfontApp, FALSE);
  185.  
  186.             //
  187.             //  clear the display
  188.             //
  189.             AppHourGlass(TRUE);
  190.             SetWindowRedraw(hedit, FALSE);
  191.             MEditPrintF(hedit, NULL);
  192.  
  193.             AcmAppDisplaySystemInfo(hedit);
  194.  
  195.             Edit_SetSel(hedit, (WPARAM)0, (LPARAM)0);
  196.  
  197.             SetWindowRedraw(hedit, TRUE);
  198.             AppHourGlass(FALSE);
  199.             return (TRUE);
  200.  
  201.         case WM_COMMAND:
  202.             uId = GET_WM_COMMAND_ID(wParam, lParam);
  203.             if ((IDOK == uId) || (IDCANCEL == uId))
  204.             {
  205.                 EndDialog(hwnd, (IDOK == uId));
  206.             }
  207.             break;
  208.     }
  209.  
  210.     return (FALSE);
  211. } // AcmAppSystemInfoDlgProc()
  212.