Declare Function waveOutGetNumDevs Lib "winmm.dll" () As Long
Platforms: Win 95/98, Win NT
waveGetNumDevs find the number of waveform output devices installed on the computer. This function can be used to determine the valid range in device identifiers for waveform output devices. The function returns the number of installed waveform output devices.
Example:
' List the names and number of channels of every installed waveform output
' device. Note how we only check the valid device identifiers.
Dim outinfo As WAVEOUTCAPS ' receives info about each device
Dim numdevs As Long ' number of installed devices
Dim thisdev As Long ' counter for which device we're checking
Dim outname As String ' buffer for device's name
Dim retval As Long ' return value
' First, determine the number of waveform output devices.
numdevs = waveOutGetNumDevs()
' Loop through each device and display the desired information. Keep in mind that the first
' device has an identifier of 0, etc.
For thisdev = 0 To numdevs - 1
' Get the capabilities of the device
retval = waveOutGetDevCaps(thisdev, outinfo, Len(outinfo))
If retval = 0 Then ' only continue if the above function succeeded
Debug.Print "Device #"; thisdev
' Extract device name from fixed-length string
outname = Left(outinfo.szPname, InStr(outinfo.szPname, vbNullChar) - 1)
Debug.Print " "; outname;
' Display number of channels -- i.e., is it mono or stereo?
If outinfo.nChannels = 1 Then
Debug.Print " (mono)"
Else
Debug.Print " (stereo)"
End If
End If
Next thisdev
Category: Audio
Go back to the alphabetical Function listing.
Go back to the Reference section index.
This page is copyright © 2000 Paul Kuliniewicz. Copyright Information.
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/w/waveoutgetnumdevs.html