Para aqueles que desejam executar um arquivo de áudio este tutorial ira ajudar a executar um arquivo WAV que está dentro do dispositivo móvel.
Classe:
1: Imports System
2: Imports System.Diagnostics
3: Imports System.IO
4: Imports System.Runtime.InteropServices
5:
6: Public Class Beep
7: <Flags()> _
8: Private Enum PlaySoundFlags
9: SND_SYNC = &H0 ' play synchronously (default)
10: SND_ASYNC = &H1 ' play asynchronously
11: SND_NODEFAULT = &H2 ' silence (!default) if sound not found
12: SND_MEMORY = &H4 ' pszSound points to a memory file
13: SND_LOOP = &H8 ' loop the sound until next sndPlaySound
14: SND_NOSTOP = &H10 ' don't stop any currently playing sound
15: SND_NOWAIT = &H2000 ' don't wait if the driver is busy
16: SND_ALIAS = &H10000 ' name is a registry alias
17: SND_ALIAS_ID = &H110000 ' alias is a predefined ID
18: SND_FILENAME = &H20000 ' name is file name
19: SND_RESOURCE = &H40004 ' name is resource name or atom
20: End Enum
21:
22: <DllImport("coredll.dll")> _
23: Public Shared Function PlaySound( _
24: ByVal szSound As String, _
25: ByVal hModule As IntPtr, _
26: ByVal flags As Integer) As Integer
27: End Function
28:
29: Public Shared Sub Play(ByVal fileName As String)
30: Try
31: PlaySound(fileName, IntPtr.Zero, PlaySoundFlags.SND_FILENAME Or _
32: PlaySoundFlags.SND_SYNC)
33: Catch ex As Exception
34: MessageBox.Show("Can't play sound file. " & ex.ToString)
35: End Try
36: End Sub
37: End Class
Programa principal:
1: Beep.Play("\Windows\decode.wav")
Com isso podemos executar um arquivo de áudio no Windows CE com VS.NET 2003
Nenhum comentário:
Postar um comentário