How to play sound ?

  • Thread starter Thread starter caozhq
  • Start date Start date
caozhq said:
I am new to mobile develop. Please help me

If just playing a sound is all you need, there's just three easy steps:

1.) to your "using" declarations add

using System.Runtime.InteropServices;

2.) to your class methods add

[DllImport("coredll.dll")] protected static extern int PlaySound(string
szSound, IntPtr hMod, int flags);

3.) play the sound by calling

PlaySound("sound.wav", IntPtr.Zero, 0x20001);


hth,

Wolf
 
Firstly you'll find this question asked freqeuently in the archives of this
group with a few different options available. You can search the archives
through a search engine such as Google Groups:-
http://groups.google.com/group/microsoft.public.dotnet.framework.compactframework?lnk=srg

If you want a specific answer can you give us a bit more detail - what sort
of sound - wav, mp3, midi etc, what is your target device and your language
of choice - VB.NET, C# etc

Peter
 
hi wolf,
for these 3 steps, it worked with me, but if i want to stop sound how could
i do that?
Thanks in advance.
Tamer..
 
Back
Top