I have a basic Windows CE 5 platform that I have built. I have
included .NET 2.0. I wrote an application to go along with it to play
audio files.

I have the following code:

[DllImport("CoreDll.DLL", EntryPoint = "PlaySound", SetLastError =
true)]
private extern static int WCE_PlaySound(string szSound, IntPtr hMod,
int flags);

WCE_PlaySound("asterisk.wav", IntPtr.Zero, (int)(Flags.SND_ASYNC |
Flags.SND_FILENAME));

This works and actually plays the asterisk.wav file as it should. If I
have this line:

WCE_PlaySound("dialtone.wav", IntPtr.Zero, (int)(Flags.SND_ASYNC |
Flags.SND_FILENAME));

It does not work. All I get is a short static sound. You will notice
they are exactly the same except for the name of the file. I have
verified that both files play just fine when I play them in windows xp
from the release folder for my platform. They are both the same
format. One is just bigger than the other one.

I have tried this with several files and the only one that has
actually played is the asterisk.

If I go into the control panel applet for sound they all play.

I am stumped.

Re: WAV File Support by ctacke/>

ctacke/>
Sun Jun 10 08:14:44 CDT 2007

CE has no concept of a current directory, so you need full paths. Have you
tried this:

WCE_PlaySound("\\Windows\\asterisk.wav", IntPtr.Zero, (int)(Flags.SND_ASYNC
|
Flags.SND_FILENAME));


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com


<tony@shatalmic.com> wrote in message
news:1181435544.333262.95970@g4g2000hsf.googlegroups.com...
>I have a basic Windows CE 5 platform that I have built. I have
> included .NET 2.0. I wrote an application to go along with it to play
> audio files.
>
> I have the following code:
>
> [DllImport("CoreDll.DLL", EntryPoint = "PlaySound", SetLastError =
> true)]
> private extern static int WCE_PlaySound(string szSound, IntPtr hMod,
> int flags);
>
> WCE_PlaySound("asterisk.wav", IntPtr.Zero, (int)(Flags.SND_ASYNC |
> Flags.SND_FILENAME));
>
> This works and actually plays the asterisk.wav file as it should. If I
> have this line:
>
> WCE_PlaySound("dialtone.wav", IntPtr.Zero, (int)(Flags.SND_ASYNC |
> Flags.SND_FILENAME));
>
> It does not work. All I get is a short static sound. You will notice
> they are exactly the same except for the name of the file. I have
> verified that both files play just fine when I play them in windows xp
> from the release folder for my platform. They are both the same
> format. One is just bigger than the other one.
>
> I have tried this with several files and the only one that has
> actually played is the asterisk.
>
> If I go into the control panel applet for sound they all play.
>
> I am stumped.
>



Re: WAV File Support by tony

tony
Mon Jun 11 10:32:59 CDT 2007

Yes. Originally that is exactly how I did it and even asterisk didn't
work. When I took off the \\Windows\\ then the asterisk.wav would
play, but still none of the others.


Re: WAV File Support by ctacke/>

ctacke/>
Mon Jun 11 11:24:59 CDT 2007

What does GetLastWin32Error return?


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com


<tony@shatalmic.com> wrote in message
news:1181575979.893293.221200@i38g2000prf.googlegroups.com...
> Yes. Originally that is exactly how I did it and even asterisk didn't
> work. When I took off the \\Windows\\ then the asterisk.wav would
> play, but still none of the others.
>



Re: WAV File Support by tony

tony
Tue Jun 12 17:41:09 CDT 2007

Ok. Here is what happens. I am not sure the GetLastError is in fact
setting the right thing because A) PlaySound returns TRUE (ok) and B)
even the sounds that play return the same error as those that don't.

I play the following sounds one after another with a dialog in between
showing the GetLastError result. Here are the files I play:

("asterisk.wav"); - works
("busy.wav"); - doesn't work
("close.wav"); - works
("critical.wav"); - works
("default.wav"); - doesn't work
("dialtone.wav"); - doesn't work
("empty.wav"); - works
("exclam.wav"); - works
("infbeg.wav"); - works
("infend.wav"); - works
("infintr.wav"); - works

I use the exact same function call on all of them and have verified
that they are all in my platform.

The error number that GetLastError returns on ALL of them is 120
(ERROR_CALL_NOT_IMPLEMENTED).

Any ideas?


Re: WAV File Support by Remi

Remi
Wed Jun 13 03:19:50 CDT 2007

What happens if you don't set the ASYNC flag?
What happens if you use PlaySound in a plain C program?

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPWSTR lpCmdLine, int nCmdShow)
{
return PlaySound(lpCmdLine, NULL, SND_ASYNC) ? 0 : 1;
}