'Play Sound
Private Declare Function PlaySound Lib "winmm.dll" (ByVal data() As Byte, _
ByVal hMod As IntPtr, ByVal hwFlags As Integer) As Integer
Private Const SND_ASYNC As Integer = &H1 'Play asynchronously
Private Const SND_MEMORY As Integer = &H4 'Play wav in memory
'The .wav will be stored in this byte array
Private Shared ClickSound As Byte()
Shared Sub New()
'Get running assembly name
Dim NameSpc As String = _
Reflection.Assembly.GetExecutingAssembly().GetName().Name.ToString()
'Look for the button click sound in the resource stream.
Dim SoundFile As String
Dim WavStrm As IO.Stream = _
Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream( _
NameSpc + "." + "DRIVEBY.WAV")
'ReDim the byte array to be the size of the embedded .wav
ReDim ClickSound(CType(WavStrm.Length, Integer))
'Load the .wav from the stream into the byte array
WavStrm.Read(ClickSound, 0, Int(CType(WavStrm.Length, Integer)))
End Sub