// To play a File from a disk locaiton
Dim objPlayer As New SoundPlayer
objPlayer.SoundLocation = "C:\Alert.wav"
objPlayer.Play()

// To play a File from applcation as embedded resouce
Dim objPlayer As New SoundPlayer
objPlayer.Stream = GetEmbeddedResourceStream()
objPlayer.Play()

Protected Function GetEmbeddedResourceStream() As Stream
  Dim objAssembly As System.Reflection.Assembly
  Dim soundstream As Stream
  objAssembly = System.Reflection.Assembly.LoadFrom(Application.ExecutablePath)
  soundstream = objAssembly.GetManifestResourceStream("Alert.wav")
  return soundstream
End Function

相关文章:

  • 2022-12-23
  • 2021-10-07
  • 2021-05-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-29
  • 2022-12-23
猜你喜欢
  • 2021-06-23
  • 2021-11-01
  • 2021-09-28
  • 2021-11-03
  • 2021-09-13
  • 2021-06-05
  • 2022-12-23
相关资源
相似解决方案