How to play an Exclamation or Asterisk sound in the .NET Compact Framework 2.0?
I want to create audible feedback to the user to signal success or failure of data validation. Playing the system Asterisk and Exclamation sounds seem to be the proper way to do this, especially since the device may have non-standard sounds configured.
The problem is that System.Media is not available in the .NET Compact Fr开发者_如何学编程amework 2.0 to play them.
What alternative ways do I have to play these system sounds?
using System.Runtime.InteropServices;
[DllImport(”winmm.dll”)]
private static extern bool PlaySound( string filename, int module, int flags );
PlaySound(Application.StartupPath + "/test.wav",0,SND_ASYNC);
There is a whole article on this here
I've been down this road. The PlaySound API (which uses CoreDll.DLL acutally) is about the only option you have.
I had a static class for this, but the results weren't loud enough and ended replacing it with code that used the Symbol.Audio classes (symbol bar code scanner).
精彩评论