play a wave

  • Thread starter Thread starter radiolandog
  • Start date Start date
R

radiolandog

No System.Media in the compact framework??
How do I play a wave file?

Thanks,
-dog
 
You can call the PlaySound API through P/Invoke. Here is the code:

[DllImport(COREDLL, EntryPoint="PlaySound", SetLastError=true)]
public extern static int PlaySound(string szSound, IntPtr hMod, int flags);

private const int SND_SYNC = 0x0000;
private const int SND_FILENAME = 0x00020000;

Then when you want to play the sound:

PlaySound(fileName, IntPtr.Zero, (int)(Flags.SND_ASYNC | Flags.SND_FILENAME));

I hope this helps.

Rick D.
Contractor
 
Back
Top