Playing/Stoping a sound

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,
I am using these 3 lines to play a sound:
1) using System.Runtime.InteropServices;

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

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

But if i want to stop a running WAV file, how could i do that?
Thanks in advance
Regards

Tamer Hesham
 
If you call PlaySound with null (Nothing in VB) for the szSound argument it
will stop playing. You may wish to take a look at the source code for the
SoundPlayer class in the SDF as this has a full wrapper around PlaySound -
www.opennetcf.org/sdf/

Peter
 
Sorry for asking again, playing and stoping WAV file worked well, now i want
to decrease and increase volume, how could i do that?

Thanks in advance..
 
P/Invoke waveOutSetVolume. Again, take Peter's advice and look at the SDF -
it's in there.

-Chris
 
Back
Top