新建From1(窗体),新建Command1(按钮CommandButton),代码:
Private Declare Function waveOutGetNumDevs Lib "winmm.dll" () As Long
Private Sub Command1_Click()
Dim i As Integer
i = waveOutGetNumDevs()
If i > 0 Then
MsgBox "系统安装了声卡。"
Else
MsgBox "系统无声卡。"
End If
End Sub