views:

48

answers:

2

I have a Data logic Memor with Windows CE 5.0 on my Applications i used only Message Box and Color Changing Labels for My Validation and Error Handling.

Now my problem is that i need to play .wav file on validation so even users do not need to look on screen every time they used the Scanner.

I tried this link http://msdn.microsoft.com/en-us/library/ms229685.aspx but doesnt work..

Data Logic Memor Doesn't Have Media Player..

Thanks in Regards!

A: 

You can play a .wav file in different ways. You don't say what compact framework you use, but for CF 3.5 you have the SoundPlayer class which is fairly easy.

        SoundPlayer p = new SoundPlayer("path");
        p.Play();

If you wont to play large files and have more flexibility have a look at these API calls:

   waveOutWrite
   waveOutOpen
   waveOutPrepareHeader
   waveOutClose

There are some work to use them. The idea is to open and initiate a wav file device with waveOutOpen and then prepare a WAVEHDR and writing it to the device with waveOutWrite. More exactly how you do it you can see in this good post. Where he describes and show you the code.

Still an other way to play a wav file is to use Windows Media Player. But I have bad experience with it. If you use it, you must be very careful to uninitiate between songs. You can also use the OpenNetCF player or use WMP directly like a com object. If you use CF 2.0 or older you have to create you AxHost by you self.

Well I hope this helps.