home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / win_lrn / sound / opensnd.lst < prev    next >
Encoding:
File List  |  1988-08-11  |  3.7 KB  |  104 lines

  1.  
  2.  
  3.                                                                        PAGE   1
  4.                                                                        08-01-88
  5.                                                                        10:22:24
  6.  
  7.  Line#  Source Line                           Microsoft C Compiler Version 5.10
  8.  
  9.       1  /*
  10.       2   *  OpenSound
  11.       3   *
  12.       4   *  This program demonstrates the use of the function OpenSound.
  13.       5   *  This function opens access to the play device ande prevents subseq
  14.          uent
  15.       6   *  opening of the device by other applications.  This function has no
  16.          
  17.       7   *  parameters.
  18.       8   *
  19.       9   */
  20.      10  
  21.      11  #include "windows.h"
  22.      12  
  23.      13  int     sprintf (PSTR, PSTR, int);
  24.      14  
  25.      15  int     PASCAL WinMain (hInstance, hPrevInstance, lpszCmdLine, cmdShow
  26.          )
  27.      16  HANDLE hInstance, hPrevInstance;
  28.      17  LPSTR lpszCmdLine;
  29.      18  int    cmdShow;
  30.      19    {
  31.      20    short    nVoices;
  32.      21    char    szBuffer[30];
  33.      22  
  34.      23    nVoices = OpenSound ();   /* Opens access to the play device and pre
  35.          vents
  36.      24                               * subsequent opening of the device by oth
  37.          er
  38.      25                               * applications.  Return value specifies t
  39.          he
  40.      26                                   * number of voices available. */
  41.      27  
  42.      28    CloseSound ();  /* CloseSound must be invoked to allow other applica
  43.          tions
  44.      29                        * to access the play device */
  45.      30  
  46.      31  /* return code for OpenSound routine */
  47.      32    if (nVoices == S_SERDVNA)
  48.      33      {
  49.      34      MessageBox (NULL, (LPSTR)"Play device in use",
  50.      35          (LPSTR)"Done", MB_OK);
  51.      36      }
  52.      37    else if (nVoices == S_SEROFM)
  53.      38      {
  54.      39      MessageBox (NULL, (LPSTR)"Insufficient memory available",
  55.      40          (LPSTR)"Done", MB_OK);
  56.      41      }
  57.      42    else
  58.      43      {
  59.      44      sprintf (szBuffer, "%d voice (s) are available", nVoices);
  60.      45      MessageBox (GetFocus (), (LPSTR)szBuffer,
  61.      46          (LPSTR)"Done", MB_OK);
  62.      47      }
  63.      48    return 0;
  64.      49    }
  65.  
  66.  
  67.                                                                        PAGE   2
  68.                                                                        08-01-88
  69.                                                                        10:22:24
  70.  
  71.                                               Microsoft C Compiler Version 5.10
  72.  
  73.  
  74.  
  75. WinMain  Local Symbols
  76.  
  77. Name                      Class   Type              Size   Offset  Register
  78.  
  79. nVoices . . . . . . . . . auto                             -0020 
  80. szBuffer. . . . . . . . . auto                             -001e 
  81. cmdShow . . . . . . . . . param                             0004
  82. lpszCmdLine . . . . . . . param                             0006
  83. hPrevInstance . . . . . . param                             000a
  84. hInstance . . . . . . . . param                             000c
  85.  
  86.  
  87. Global Symbols
  88.  
  89. Name                      Class   Type              Size   Offset  
  90.  
  91. CloseSound. . . . . . . . extern  far function       ***     ***
  92. GetFocus. . . . . . . . . extern  far function       ***     ***
  93. MessageBox. . . . . . . . extern  far function       ***     ***
  94. OpenSound . . . . . . . . extern  far function       ***     ***
  95. WinMain . . . . . . . . . global  near function      ***    0000
  96. pLocalHeap. . . . . . . . common  near pointer         2     ***
  97. sprintf . . . . . . . . . extern  near function      ***     ***
  98.  
  99. Code size = 0094 (148)
  100. Data size = 005b (91)
  101. Bss size  = 0000 (0)
  102.  
  103. No errors detected
  104.