I simply lost the dogbark.wav file on my smartphone when I did the reset. Can anyone please tell me where I can download it or a way I can retrieve it again. I searched the device and for some reason it has disappeared. I called Cingular and they wont help me and said I should call Microsoft. I called Microsoft and they wanted to charge me like $70 bucks to send me the file. All I need is this silly dogbark.wav. My daughter gets a kick out of it every time she hears it. Any help would be greatly appreciated.
Sorry for the late reply Actually i found the way my self to play wav files using coredll. From other forums if anyone needs some code ill be glad to post it.
Thanks 'drewex' and 'topcaser' also..... with the code you provided drewex, and the path suggestion you provided topcaser ("\windows\alarm1.wav") I can quit banging my head and rejoice in the fact that my pocket PC app will now play the alarm1.wav via the emulator when I debug! Yay!!!
thanks to you dudes I am 'gettin it done'......
Here is the FULL CODE for creating a simple one-button application for activating the alarms/sounds on the PPC emulator for a Visual Basic .NET 2003 'smart device Pocket PC application'. This works for me, your results may vary. Keep this simple app in your code archives and scab from it when you develop projects.....
1. create a new 'smart device' application
2. delete ALL the code underneath the new app so you have a blank white space
3. paste all this code into the blank white space
4. a button called 'button1' should automatically appear on the interface when you paste this code... be sure it's there.
5. start the emulator
When you click the button on the emulator you should hear 'alarm1.wav' from the PPC device emulation folder play.
NOTE: If you don't hear anything, be sure to go to START >>>'settings' >>>'sounds and notifications'... and check to make sure the sounds and alarms are acutally enabled within the emulator.
NOTE: the 'Windows Form Designer generated code' section will automatically be expanded after you paste in this code.... just click on the minus sign next to where it says: #Region " Windows Form Designer generated code "
This will cause this section to contract and be hidden with a '+' sign next to it and get it out of the way....
I hope this works for you too!
jazjef
>>>>>>>> code starts here >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Public Class Form1 Inherits System.Windows.Forms.Form Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
#Region " Windows Form Designer generated code "
Public Sub New() MyBase.New()
'This call is required by the Windows Form Designer. InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) MyBase.Dispose(disposing) End Sub
'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Private Sub InitializeComponent() Me.MainMenu1 = New System.Windows.Forms.MainMenu Me.Button1 = New System.Windows.Forms.Button ' 'Button1 ' Me.Button1.Location = New System.Drawing.Point(64, 104) Me.Button1.Size = New System.Drawing.Size(104, 40) Me.Button1.Text = "Button1" ' 'Form1 ' Me.Controls.Add(Me.Button1) Me.Menu = Me.MainMenu1 Me.Text = "Form1"
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim mySound As New Sound("\windows\alarm1.wav")
mySound.Play()
End Sub End Class
Public Class Sound
Private m_soundBytes() As Byte
Private m_fileName As String
Public Declare Function WCE_PlaySound Lib "CoreDll.dll" Alias "PlaySound" (ByVal szSound As String, ByVal hMod As IntPtr, ByVal flags As Integer) As Integer
Public Declare Function WCE_PlaySoundBytes Lib "CoreDll.dll" Alias "PlaySound" (ByVal szSound() As Byte, ByVal hMod As IntPtr, ByVal flags As Integer) As Integer
Private Enum Flags
SND_SYNC = &H0 ' play synchronously (default)
SND_ASYNC = &H1 ' play asynchronously
SND_NODEFAULT = &H2 ' silence (!default) if sound not found
SND_MEMORY = &H4 ' pszSound points to a memory file
SND_LOOP = &H8 ' loop the sound until next sndPlaySound
SND_NOSTOP = &H10 ' don't stop any currently playing sound
SND_NOWAIT = &H2000 ' don't wait if the driver is busy
SND_ALIAS = &H10000 ' name is a registry alias
SND_ALIAS_ID = &H110000 ' alias is a predefined ID
SND_FILENAME = &H20000 ' name is file name
SND_RESOURCE = &H40004 ' name is resource name or atom
End Enum
' Construct the Sound object to play sound data from the specified file.
Public Sub New(ByVal fileName As String)
m_fileName = fileName
End Sub
' Construct the Sound object to play sound data from the specified stream.
Public Sub New(ByVal stream As System.IO.Stream)
' read the data from the stream
m_soundBytes = New Byte(stream.Length) {}
stream.Read(m_soundBytes, 0, Fix(stream.Length))
End Sub 'New
' Play the sound
Public Sub Play()
' If a file name has been registered, call WCE_PlaySound,
' otherwise call WCE_PlaySoundBytes.
If Not (m_fileName Is Nothing) Then
WCE_PlaySound(m_fileName, IntPtr.Zero, Fix(Flags.SND_SYNC Or Flags.SND_FILENAME))
Else
WCE_PlaySoundBytes(m_soundBytes, IntPtr.Zero, Fix(Flags.SND_ASYNC Or Flags.SND_MEMORY))
Ok i dont have ppc 2005. But here how i called coredll for my 2003.
Dim
mySound As New Sound("/Storage/my documents/my sounds/dogbark.WAV")
mySound.Play()
use this to call the funxtions below
Public Class Sound
Private m_soundBytes() As Byte
Private m_fileName As String
Public
Declare Function WCE_PlaySound Lib "CoreDll.dll" Alias "PlaySound" (ByVal szSound As String, ByVal hMod As IntPtr, ByVal flags As Integer) As Integer
Public Declare Function WCE_PlaySoundBytes Lib "CoreDll.dll" Alias "PlaySound" (ByVal szSound() As Byte, ByVal hMod As IntPtr, ByVal flags As Integer) As Integer
Private Enum Flags
SND_SYNC = &H0
' play synchronously (default)
SND_ASYNC = &H1
' play asynchronously
SND_NODEFAULT = &H2
' silence (!default) if sound not found
SND_MEMORY = &H4
' pszSound points to a memory file
SND_LOOP = &H8
' loop the sound until next sndPlaySound
SND_NOSTOP = &H10
' don't stop any currently playing sound
SND_NOWAIT = &H2000
' don't wait if the driver is busy
SND_ALIAS = &H10000
' name is a registry alias
SND_ALIAS_ID = &H110000
' alias is a predefined ID
SND_FILENAME = &H20000
' name is file name
SND_RESOURCE = &H40004
' name is resource name or atom
End Enum
' Construct the Sound object to play sound data from the specified file.
Public Sub New(ByVal fileName As String)
m_fileName = fileName
End Sub
' Construct the Sound object to play sound data from the specified stream.
Public Sub New(ByVal stream As Stream)
' read the data from the stream
m_soundBytes =
New Byte(stream.Length) {}
stream.Read(m_soundBytes, 0, Fix(stream.Length))
End Sub 'New
' Play the sound
Public Sub Play()
' If a file name has been registered, call WCE_PlaySound,
' otherwise call WCE_PlaySoundBytes.
If Not (m_fileName Is Nothing) Then
i have tried this code snippet. It is working perfectly on my PPC emulator. But if i perform a build for my device no sound is played on the device itself. I am using the code snippet with following file: "\windows\alarm1.wav"
[Edit]
I get it working now. The file was missing
But now i have the problem, that the sound is never stopped. In the emulator it works perfectly but not on the device. I have to switch off volume...
Here is the code which i tried to stop the sound:
Sub stopPlayingSound()
Const SND_ASYNC = &H1 ' play asynchronously
Const SND_NODEFAULT = &H2 ' silence (!default) if sound not found
Const SND_NOWAIT = &H2000 ' don't wait if the driver is busy
Const SND_FILENAME = &H20000 ' name is file name
Dim flag As Long
Playing sounds
Meff
thank you it's very useful code i try it in visual basic 2005 beta 2 and work after small edit
thank you
Márcio Rosa
kopi
Do you have the vb code
I can't figure out how to add core.dll to my vs mobile 2005 project.
alainkkk
Actually i found the way my self to play wav files using coredll. From other forums if anyone needs some code ill be glad to post it.
Manuel5
Thanks 'drewex' and 'topcaser' also..... with the code you provided drewex, and the path suggestion you provided topcaser ("\windows\alarm1.wav") I can quit banging my head and rejoice in the fact that my pocket PC app will now play the alarm1.wav via the emulator when I debug! Yay!!!
thanks to you dudes I am 'gettin it done'......
Here is the FULL CODE for creating a simple one-button application for activating the alarms/sounds on the PPC emulator for a Visual Basic .NET 2003 'smart device Pocket PC application'. This works for me, your results may vary. Keep this simple app in your code archives and scab from it when you develop projects.....
1. create a new 'smart device' application
2. delete ALL the code underneath the new app so you have a blank white space
3. paste all this code into the blank white space
4. a button called 'button1' should automatically appear on the interface when you paste this code... be sure it's there.
5. start the emulator
When you click the button on the emulator you should hear 'alarm1.wav' from the PPC device emulation folder play.
NOTE: If you don't hear anything, be sure to go to START >>>'settings' >>>'sounds and notifications'... and check to make sure the sounds and alarms are acutally enabled within the emulator.
NOTE: the 'Windows Form Designer generated code' section will automatically be expanded after you paste in this code.... just click on the minus sign next to where it says: #Region " Windows Form Designer generated code "
This will cause this section to contract and be hidden with a '+' sign next to it and get it out of the way....
I hope this works for you too!
jazjef
>>>>>>>> code starts here >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Public Class Form1
Inherits System.Windows.Forms.Form
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
MyBase.Dispose(disposing)
End Sub
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Private Sub InitializeComponent()
Me.MainMenu1 = New System.Windows.Forms.MainMenu
Me.Button1 = New System.Windows.Forms.Button
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(64, 104)
Me.Button1.Size = New System.Drawing.Size(104, 40)
Me.Button1.Text = "Button1"
'
'Form1
'
Me.Controls.Add(Me.Button1)
Me.Menu = Me.MainMenu1
Me.Text = "Form1"
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim mySound As New Sound("\windows\alarm1.wav")
mySound.Play()
End Sub
End Class
Public Class Sound
Private m_soundBytes() As Byte
Private m_fileName As String
Public Declare Function WCE_PlaySound Lib "CoreDll.dll" Alias "PlaySound" (ByVal szSound As String, ByVal hMod As IntPtr, ByVal flags As Integer) As Integer
Public Declare Function WCE_PlaySoundBytes Lib "CoreDll.dll" Alias "PlaySound" (ByVal szSound() As Byte, ByVal hMod As IntPtr, ByVal flags As Integer) As Integer
Private Enum Flags
SND_SYNC = &H0 ' play synchronously (default)
SND_ASYNC = &H1 ' play asynchronously
SND_NODEFAULT = &H2 ' silence (!default) if sound not found
SND_MEMORY = &H4 ' pszSound points to a memory file
SND_LOOP = &H8 ' loop the sound until next sndPlaySound
SND_NOSTOP = &H10 ' don't stop any currently playing sound
SND_NOWAIT = &H2000 ' don't wait if the driver is busy
SND_ALIAS = &H10000 ' name is a registry alias
SND_ALIAS_ID = &H110000 ' alias is a predefined ID
SND_FILENAME = &H20000 ' name is file name
SND_RESOURCE = &H40004 ' name is resource name or atom
End Enum
' Construct the Sound object to play sound data from the specified file.
Public Sub New(ByVal fileName As String)
m_fileName = fileName
End Sub
' Construct the Sound object to play sound data from the specified stream.
Public Sub New(ByVal stream As System.IO.Stream)
' read the data from the stream
m_soundBytes = New Byte(stream.Length) {}
stream.Read(m_soundBytes, 0, Fix(stream.Length))
End Sub 'New
' Play the sound
Public Sub Play()
' If a file name has been registered, call WCE_PlaySound,
' otherwise call WCE_PlaySoundBytes.
If Not (m_fileName Is Nothing) Then
WCE_PlaySound(m_fileName, IntPtr.Zero, Fix(Flags.SND_SYNC Or Flags.SND_FILENAME))
Else
WCE_PlaySoundBytes(m_soundBytes, IntPtr.Zero, Fix(Flags.SND_ASYNC Or Flags.SND_MEMORY))
End If
End Sub
End Class
pgorbas
hi
thanks for code. I need a help from u . i want to have C#.net code using .net version 2 on pocket pc 2003.
and how do i use this code on my single button click please help............... . i tried with vb.net to c#.net converter but it didn't work.
Fix method not found in C#.net . So i badly need ur help . please;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Hope u will reply as soon as possible.
Many many thaks in advance.
Laputa09
Wim De Coninck
Attu
Ok i dont have ppc 2005. But here how i called coredll for my 2003.
Dim
mySound As New Sound("/Storage/my documents/my sounds/dogbark.WAV")mySound.Play()
use this to call the funxtions below
Public Class Sound Private m_soundBytes() As Byte Private m_fileName As StringPublic
Declare Function WCE_PlaySound Lib "CoreDll.dll" Alias "PlaySound" (ByVal szSound As String, ByVal hMod As IntPtr, ByVal flags As Integer) As Integer Public Declare Function WCE_PlaySoundBytes Lib "CoreDll.dll" Alias "PlaySound" (ByVal szSound() As Byte, ByVal hMod As IntPtr, ByVal flags As Integer) As Integer
Private Enum FlagsSND_SYNC = &H0
' play synchronously (default)SND_ASYNC = &H1
' play asynchronouslySND_NODEFAULT = &H2
' silence (!default) if sound not foundSND_MEMORY = &H4
' pszSound points to a memory fileSND_LOOP = &H8
' loop the sound until next sndPlaySoundSND_NOSTOP = &H10
' don't stop any currently playing soundSND_NOWAIT = &H2000
' don't wait if the driver is busySND_ALIAS = &H10000
' name is a registry aliasSND_ALIAS_ID = &H110000
' alias is a predefined IDSND_FILENAME = &H20000
' name is file nameSND_RESOURCE = &H40004
' name is resource name or atom End Enum ' Construct the Sound object to play sound data from the specified file. Public Sub New(ByVal fileName As String)m_fileName = fileName
End Sub ' Construct the Sound object to play sound data from the specified stream. Public Sub New(ByVal stream As Stream) ' read the data from the streamm_soundBytes =
New Byte(stream.Length) {}stream.Read(m_soundBytes, 0, Fix(stream.Length))
End Sub 'New ' Play the sound Public Sub Play() ' If a file name has been registered, call WCE_PlaySound, ' otherwise call WCE_PlaySoundBytes. If Not (m_fileName Is Nothing) ThenWCE_PlaySound(m_fileName, IntPtr.Zero, Fix(Flags.SND_SYNC
Or Flags.SND_FILENAME)) ElseWCE_PlaySoundBytes(m_soundBytes, IntPtr.Zero, Fix(Flags.SND_ASYNC
Or Flags.SND_MEMORY)) End If End Sub End Classthis is what i have hope it works for you
MReinhardt
Hi,
i have tried this code snippet. It is working perfectly on my PPC emulator. But if i perform a build for my device no sound is played on the device itself. I am using the code snippet with following file: "\windows\alarm1.wav"
[Edit]
I get it working now. The file was missing
But now i have the problem, that the sound is never stopped. In the emulator it works perfectly but not on the device. I have to switch off volume...
Here is the code which i tried to stop the sound:
Sub stopPlayingSound() Const SND_ASYNC = &H1 ' play asynchronously Const SND_NODEFAULT = &H2 ' silence (!default) if sound not found Const SND_NOWAIT = &H2000 ' don't wait if the driver is busy Const SND_FILENAME = &H20000 ' name is file name Dim flag As Longflag = SND_ASYNC
Or SND_NODEFAULT Or SND_NOWAIT Or SND_FILENAMEWCE_PlaySound(
"", IntPtr.Zero, flag) End Sub[/Edit]
I am using WM05 with visual studio 2005
Any hints
BillH133092
then call MySound.Play and it will stop.
For those of you that would like to know :)