Play standard sound

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

how can I play a windows standard sound (like the one when an error occurrs)
out of my vb.net project?

Thanks
Peter
 
Hi Peter,
Declare this before the form's load event:
Private Declare Function PlaySound _

Lib "WINMM.DLL" Alias "sndPlaySoundA" _

(ByVal lpszSoundName As String, _

ByVal uFlags As Long) As Long

Private Enum playsoundflags

async = &H1

sync = &H0

End Enum

Then call it like this:

PlaySound("c:\mozart3.wav", playsoundflags.async)

HTH,

Bernie Yaeger
 
Back
Top