'Clarations...
'Play sound flags
Private const snd_async as integer = & H1
Private const snd_loop as integer = & H8
Private const snd_memory as integer = & h4
Private const snd_nodefault as integer = & H2
Private const snd_nostop as integer = & H10
Private const snd_sync as integer = & H0
'Play sound Declaration
Declare function sndplaysound lib "winmm. dll" alias "sndplaysounda" (byval lpszsoundname as byte (), byval uflags as integer) as integer
'Calling code...
'Name of the resource to extract
Dim rname as string = "cameraclick.wav"
'Obtain the Assembly name and replace '-' with an underscore
Dim rschema as string = Replace (reflection. Assembly. getexecutingassembly. getname. Name, "-", "_") & "." & rname
'Retreive the resource as a stream
Dim rstream as Io. Stream = reflection. Assembly. getexecutingassembly. getmanifestresourcestream (rschema)
'Read the stream into a byte Buffer
Dim buffer (rstream. Length) as byte
Rstream. Read (buffer, 0, buffer. Length-1)
'Play the sound
Sndplaysound (buffer, snd_memory or snd_async)