auxGetNumDevs Function

Declare Function auxGetNumDevs Lib "winmm.dll" () As Long

Platforms

Description & Usage

auxGetNumDevs determines how many auxiliary audio devices are installed on the computer. This could be less than the number of devices actually present on the computer, since it is possible for a device to be installed yet not be connected or functioning.

Return Value

The function returns the number of auxiliary audio devices installed on the system.

Visual Basic-Specific Issues

None.

Parameters

None.

Example

' This code is licensed according to the terms and conditions listed here.

' Loop through each auxiliary audio device installed on the system
' and display its name and version number.
Dim auxinfo As AUXCAPS  ' receives info about each device
Dim numdevs As Long  ' number of auxiliary audio devices installed
Dim devname As String  ' name of device
Dim majver As Integer, minver As Integer  ' major and minor version numbers
Dim c As Long  ' counter variable
Dim retval As Long  ' return value

' Find out how many auxiliary audio devices are installed.
numdevs = auxGetNumDevs()

' Loop through each one, displaying its name and version number.
For c = 0 To numdevs - 1  ' remember that device IDs are zero-based!
  ' Get the capabilities of this device.
  retval = auxGetDevCaps(c, auxinfo, Len(auxinfo))
  If retval = 0 Then
    Debug.Print "** AUXILIARY AUDIO DEVICE"; c; "**"
    ' Extract and display the name of the device.
    devname = Left(auxinfo.szPname, InStr(auxinfo.szPname, vbNullChar) - 1)
    Debug.Print "Name: "; devname
    ' Extract and display the version number of the device.
    majver = (auxinfo.vDriverVersion And &HFF00) / &H100  ' major version
    minver = auxinfo.vDriverVersion And &HFF  ' minor version
    Debug.Print "Version Number:"; majver; "."; minver
  Else
    Debug.Print "Could not get information about device"; c; "."
  End If
Next c

Category

Audio

Go back to the alphabetical Function listing.
Go back to the Reference section index.


Last Modified: September 6, 1999
This page is copyright © 1999 Paul Kuliniewicz. Copyright Information Revised October 29, 2000
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/a/auxgetnumdevs.html