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