Hallo
ich versuche eine wav wiederzugeben, die in dem Projekt eingebunden ist (siehe Bild)
Ich bekomme aber bei der Variabel "resourceStream" nur Nothing zurück.
kann mir jmd sagen, was ich da falsch mache oder falsch verstanden habe ?
DANKE FÜRS LESEN, ABER ICH HABE ES GELÖST
ich versuche eine wav wiederzugeben, die in dem Projekt eingebunden ist (siehe Bild)
Ich bekomme aber bei der Variabel "resourceStream" nur Nothing zurück.
kann mir jmd sagen, was ich da falsch mache oder falsch verstanden habe ?
VB.NET-Quellcode
- Public Sub PlaySound(index As SoundIndex)
- Dim snd As String
- Select Case index
- Case SoundIndex.sndJobCancel
- snd = "sndJobCancel.wav"
- Case SoundIndex.sndJobEnd
- snd = "sndJobEnd.wav"
- Case SoundIndex.sndJobStart
- snd = "sndJobStart.wav"
- Case SoundIndex.sndMenuPopup
- snd = "sndMenuPopup.wav"
- End Select
- Const SND_ASYNC = &H1
- Const SND_MEMORY = &H4
- Dim strNameSpace As String = Reflection.Assembly.GetExecutingAssembly().GetName().Name.ToString()
- ' get the resource into a stream
- Dim resourceStream As IO.Stream = Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(strNameSpace & "." & snd) '<-- Hier bekomme ich Nothing zurück
- If resourceStream Is Nothing Then Exit Sub
- ' bring stream into a byte array
- Dim wavData As Byte()
- ReDim wavData(CInt(resourceStream.Length))
- resourceStream.Read(wavData, 0, CInt(resourceStream.Length))
- ' play the resource
- PlaySound(wavData, 0, SND_ASYNC Or SND_MEMORY)
- End Sub
DANKE FÜRS LESEN, ABER ICH HABE ES GELÖST
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „woeh“ ()