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