Rated
Read 43,646 times
Related Categories
Detect a sound card
Ever wanted to know if a PC has a sound card or not? This simple piece of code does exactly that!
Private Declare Function waveOutGetNumDevs Lib "winmm.dll" () As Long
Private Sub cmdCanPlay_Click()
Dim i As Long
i = waveOutGetNumDevs()
If i > 0 Then
MsgBox "Your system can play
sound files.", _
vbInformation, "Sound Card
Test"
Else
MsgBox "Your system can not play
sound Files.", _
vbInformation, "Sound Card
Test"
End If
End Sub
James first started writing tutorials on Visual Basic in 1999 whilst starting this website (then known as VB Web). Since then, the site has grown rapidly, and James has written numerous tutorials, articles and reviews on VB, PHP, ASP and C#. In October 2003, James formed the company Developer Fusion Ltd, which owns this website, and also offers various development services. In his spare time, he's a 3rd year undergraduate studying Computer Science in the UK. He's also a Visual Basic MVP.
Comments
-
Posted by PDivy on 08 Jun 2007
Where do you input this code to detect your sound card? -
Posted by nurse1 on 01 May 2007
Okay... I figured it out... you have to put something into the () like this;
Private Sub... -
Posted by nurse1 on 01 May 2007
I'm a newbie also, and it's not working on my computer...
Sound card is a VIA AC'97 Enhanced Audio Controller (WDM)
is there supposed to be a file called winmm.dll on my compu... -
Posted by nurse1 on 01 May 2007
That's some great code, but what would it look like if you wanted it to do it just once.
For instance, once the user clicks ok, he/she never sees the message again. -
Posted by bengarrion on 18 Jul 2002
It worked first time and im a very new newmbie
|