VB.Net Tutorial/Windows/Sound Card
Версия от 16:40, 26 мая 2010; (обсуждение)
Sound card checker
Imports System.Net
Imports System.Windows.Forms
public class Tester
public Shared Sub Main
Dim i As Integer
i = waveOutGetNumDevs()
If i > 0 Then
Console.WriteLine("Can play wav file")
Else
Console.WriteLine("cannot play wav file")
End If
End Sub
Private Declare Auto Function PlaySound Lib "winmm.dll" (ByVal lpszSoundName As String, ByVal hModule As Integer, ByVal dwFlags As Integer) As Integer
Const SND_FILENAME As Integer = &H20000
Const SND_ALIAS As Integer = &H10000
Const SND_SYNC As Integer = &H0
Declare Auto Function waveOutGetNumDevs Lib "winmm.dll" Alias "waveOutGetNumDevs" () As Int32
Declare Auto Function sndPlaySound Lib "WINMM.DLL" (ByVal FileName As String, ByVal Options As Int32) As Int32
Private Const SND_MEMORY As Integer = &H4
Private Const SND_ASYNC As Integer = &H1
Private Const PROCESS_DOMAIN As String = ""
Const SND_SYNC1 = &H0
Const SND_ASYNC1 = &H1
Const SND_NODEFAULT = &H2
Const SND_LOOP = &H8
Const SND_NOSTOP = &H10
End class