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

  1.  
  2.  
  3.                                                                        PAGE   1
  4.                                                                        06-24-88
  5.                                                                        14:11:06
  6.  
  7.  Line#  Source Line                           Microsoft C Compiler Version 5.10
  8.  
  9.       1  /*
  10.       2   *  Function Name:   CloseSound
  11.       3   *  Program Name:    CloseSnd.c
  12.       4   *  SDK Version:         2.03
  13.       5   *  Runtime Version:     2.03
  14.       6   *  Microsoft C Version: 5.0
  15.       7   *
  16.       8   *  Description:
  17.       9   *   CloseSound closes access to the play device and frees the device 
  18.          for
  19.      10   *   opening by other applications.  the CloseSound function flushes a
  20.          ll
  21.      11   *   voice queues and frees any buffers allocated for these queues.
  22.      12   */
  23.      13  
  24.      14  #include "windows.h"
  25.      15  #include "stdio.h"
  26.      16  
  27.      17  
  28.      18  long FAR PASCAL WndProc(HWND, unsigned, WORD, LONG);
  29.      19  
  30.      20  /*********************************************************************
  31.          **/
  32.      21  
  33.      22  void CALL_CloseSound(hWnd)
  34.      23  HWND hWnd;
  35.      24  
  36.      25  {   char szBuffer[30];
  37.      26      short nVoices; /* Specifies the number of voices available. */
  38.      27  
  39.      28      nVoices = OpenSound(); /* Opens access to play device, locks it fr
  40.          om  */
  41.      29                             /* further users, returns the number of voi
  42.          ces */
  43.      30                             /* available.                              
  44.              */
  45.      31      
  46.      32      if (nVoices == S_SERDVNA)
  47.      33      {MessageBox( NULL, (LPSTR) "Play device in use.",(LPSTR) "Error",M
  48.          B_OK);
  49.      34      } else if (nVoices == S_SEROFM)
  50.      35      {MessageBox( NULL, (LPSTR) "Insufficient memory available.",
  51.      36                         (LPSTR) "Error\0",MB_OK );
  52.      37      
  53.      38      
  54.      39      } else  
  55.      40      {sprintf(szBuffer,"%d voice(s) are available.",nVoices);
  56.      41       MessageBox( NULL, (LPSTR) szBuffer,
  57.      42                         (LPSTR)"Mission Accomplished\0", MB_OK);
  58.      43  
  59.      44  
  60.      45       CloseSound();    /* Closesnd closes the play device, allowing oth
  61.          er */
  62.      46                       /* applications to use the device.               
  63.            */
  64.      47      }
  65.  
  66.  
  67.                                                                        PAGE   2
  68.                                                                        06-24-88
  69.                                                                        14:11:06
  70.  
  71.  Line#  Source Line                           Microsoft C Compiler Version 5.10
  72.  
  73.      48      if ((nVoices!=S_SEROFM) && (nVoices!=S_SERDVNA))
  74.      49      {MessageBox( NULL, (LPSTR)"CloseSound complete, device available."
  75.          ,
  76.      50                         (LPSTR)"Mission Accomplished\0", MB_OK);
  77.      51      } else
  78.      52      {MessageBox( NULL, (LPSTR)"Device unavailable, try later",
  79.      53                         (LPSTR)"Mission Failed", MB_OK);
  80.      54  
  81.      55         }
  82.      56  
  83.      57  return;
  84.      58  }
  85.  
  86.  
  87. CALL_CloseSound  Local Symbols
  88.  
  89. Name                      Class   Type              Size   Offset  Register
  90.  
  91. szBuffer. . . . . . . . . auto                             -0020 
  92. nVoices . . . . . . . . . auto                             -0002 
  93. hWnd. . . . . . . . . . . param                             0004
  94.  
  95.      59  
  96.      60  /*********************************************************************
  97.          *****/
  98.      61  
  99.      62  int PASCAL WinMain( hInstance, hPrevInstance, lpszCmdLine, cmdShow )
  100.      63  HANDLE hInstance, hPrevInstance;
  101.      64  LPSTR lpszCmdLine;
  102.      65  int cmdShow;
  103.      66  {
  104.      67      MSG   msg;
  105.      68      HWND  hWnd;
  106.      69      HMENU hMenu;
  107.      70  
  108.      71      CALL_CloseSound(hWnd);
  109.      72      return 0;
  110.      73  }
  111.  
  112.  
  113. WinMain  Local Symbols
  114.  
  115. Name                      Class   Type              Size   Offset  Register
  116.  
  117. hMenu . . . . . . . . . . auto                             -0016 
  118. msg . . . . . . . . . . . auto                             -0014 
  119. hWnd. . . . . . . . . . . auto                             -0002 
  120. cmdShow . . . . . . . . . param                             0004
  121. lpszCmdLine . . . . . . . param                             0006
  122. hPrevInstance . . . . . . param                             000a
  123. hInstance . . . . . . . . param                             000c
  124.  
  125.  
  126.  
  127.                                                                        PAGE   3
  128.                                                                        06-24-88
  129.                                                                        14:11:06
  130.  
  131.                                               Microsoft C Compiler Version 5.10
  132.  
  133. Global Symbols
  134.  
  135. Name                      Class   Type              Size   Offset  
  136.  
  137. CALL_CloseSound . . . . . global  near function      ***    0000
  138. CloseSound. . . . . . . . extern  far function       ***     ***
  139. MessageBox. . . . . . . . extern  far function       ***     ***
  140. OpenSound . . . . . . . . extern  far function       ***     ***
  141. WinMain . . . . . . . . . global  near function      ***    00d0
  142. pLocalHeap. . . . . . . . common  near pointer         2     ***
  143. sprintf . . . . . . . . . extern  near function      ***     ***
  144.  
  145. Code size = 00f0 (240)
  146. Data size = 00db (219)
  147. Bss size  = 0000 (0)
  148.  
  149. No errors detected
  150.