Visual Basic FAQ

waveOutGetNumDevices: Wave Compatibility Test
     
Posted:   Sunday December 29, 1996
Updated:   Monday December 26, 2011
     
Applies to:   VB4-32, VB5, VB6, and VB3, VB4-16 with appropriate declarations
     
 Prerequisites
None.

The waveOutGetNumDevices API from winmm.dll or mmsystem.dll returns the number of wave-capable devices on a system.
 BAS Module Code
None.

 Form Code
Add a command button to a form and the following code:

Option Explicit
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Copyright 1996-2011 VBnet/Randy Birch, All Rights Reserved.
' Some pages may also contain other copyrights by the author.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Distribution: You can freely use this code in your own
'               applications, but you may not reproduce 
'               or publish this code on any web site,
'               online service, or distribute as source 
'               on any media without express permission.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Declare Function waveOutGetNumDevs Lib "winmm.dll" () As Long


Private Sub Command1_Click()

    Dim waveTest As Long
    
    waveTest = waveOutGetNumDevs()
    
    If waveTest > 0 Then
       MsgBox "Your system can play wave sounds."
    Else
       MsgBox "Your system does not support waves."
    End If

End Sub
 Comments
Users of the 16-bit versions of Visual Basic (VB3 / VB4-16) should alter the declare above to reflect the changes below:

   ... waveOutGetNumDevs Lib "mmsystem" () As Integer

In addition, the return variable 'waveTest' should be declared 'As Integer'


 
 

PayPal Link
Make payments with PayPal - it's fast, free and secure!

 
 
 
 

Copyright 1996-2011 VBnet and Randy Birch. All Rights Reserved.
Terms of Use  |  Your Privacy

 

Hit Counter