ID: Q123974
2.00 3.00 WINDOWS kbprg APrgWindow
The information in this article applies to:
- Standard and Professional Editions of Microsoft Visual Basic for
  Windows, versions 2.0 and 3.0
It is often useful to be able to detect if a system has a sound card capable of playing back wave audio data (.WAV files). This article demonstrates how to do this.
The multimedia Application Programming Interface (API) has a function, waveOutGetNumDevs(), which returns the number of devices in the system capable of playing back wave audio data.
1. Start a new project in Visual Basic (ALT, F, N), and place a Command'
   button (Command1) on Form1.
   Form1:
   Declare Function waveOutGetNumDevs Lib "MMSYSTEM" () As Integer
   Sub Command1_Click ()
      Dim i As Integer
      i = waveOutGetNumDevs()
      If i > 0 Then         ' There is at least one.
         MsgBox "You Can Play Wave Data"
      Else
         MsgBox "Cannot Play Wave Data"
      End If
   End Sub
   appropriate message will let you know if your computer play wave audio
   data.
Keywords          : kbprg
Version           : 2.00 3.00
Platform          : WINDOWSLast Reviewed: May 12, 1998