From: jp2msft on
I have added the "aygshell" reference to SndPlaySync to my Pocket PC 2003
project using:

[code]
[DllImport("aygshell.dll", SetLastError = true)]
static extern IntPtr SndPlaySync(string Path, uint Flags);
[/code]

In my code, I try calling SndPlaySync using this code:

[code]
IntPtr ip;
if (System.IO.File.Exists(file) == true) {
ip = SndPlaySync(file, 0);
}
[/code]

However, SndPlaySync is throwing this MissingMethodException message:

Message="Can't find an Entry Point 'SndPlaySync' in a PInvoke DLL
'aygshell.dll'."

How do I fix this?

Am I calling the SndPlaySync function incorrectly? Is the DLL reference
incorrect? What else could it be?
From: Peter Foot on
This API was added in Windows Mobile 6. You can't call it on older devices
as you'll get this error. You can use PlaySound instead but it is limited to
..wav files only.

Peter

--
Peter Foot
Microsoft Device Application Development MVP
peterfoot.net | appamundi.com | inthehand.com
APPA Mundi Ltd - Software Solutions for a Mobile World
In The Hand Ltd - .NET Components for Mobility

"jp2msft" <jp2msft(a)discussions.microsoft.com> wrote in message
news:CD217ACB-8861-44B4-A15D-7F705CD736BA(a)microsoft.com...
>I have added the "aygshell" reference to SndPlaySync to my Pocket PC 2003
> project using:
>
> [code]
> [DllImport("aygshell.dll", SetLastError = true)]
> static extern IntPtr SndPlaySync(string Path, uint Flags);
> [/code]
>
> In my code, I try calling SndPlaySync using this code:
>
> [code]
> IntPtr ip;
> if (System.IO.File.Exists(file) == true) {
> ip = SndPlaySync(file, 0);
> }
> [/code]
>
> However, SndPlaySync is throwing this MissingMethodException message:
>
> Message="Can't find an Entry Point 'SndPlaySync' in a PInvoke DLL
> 'aygshell.dll'."
>
> How do I fix this?
>
> Am I calling the SndPlaySync function incorrectly? Is the DLL reference
> incorrect? What else could it be?

From: jp2msft on
Thanks. That goes a long way towards helping me out! :)

"Peter Foot" wrote:

> This API was added in Windows Mobile 6. You can't call it on older devices
> as you'll get this error. You can use PlaySound instead but it is limited to
> .wav files only.
>
> Peter
>
> --
> Peter Foot
> Microsoft Device Application Development MVP
> peterfoot.net | appamundi.com | inthehand.com
> APPA Mundi Ltd - Software Solutions for a Mobile World
> In The Hand Ltd - .NET Components for Mobility
>
> "jp2msft" <jp2msft(a)discussions.microsoft.com> wrote in message
> news:CD217ACB-8861-44B4-A15D-7F705CD736BA(a)microsoft.com...
> >I have added the "aygshell" reference to SndPlaySync to my Pocket PC 2003
> > project using:
> >
> > [code]
> > [DllImport("aygshell.dll", SetLastError = true)]
> > static extern IntPtr SndPlaySync(string Path, uint Flags);
> > [/code]
> >
> > In my code, I try calling SndPlaySync using this code:
> >
> > [code]
> > IntPtr ip;
> > if (System.IO.File.Exists(file) == true) {
> > ip = SndPlaySync(file, 0);
> > }
> > [/code]
> >
> > However, SndPlaySync is throwing this MissingMethodException message:
> >
> > Message="Can't find an Entry Point 'SndPlaySync' in a PInvoke DLL
> > 'aygshell.dll'."
> >
> > How do I fix this?
> >
> > Am I calling the SndPlaySync function incorrectly? Is the DLL reference
> > incorrect? What else could it be?
>
From: jp2msft on
Rats! VS2005 or Pocket PC didn't like that either.

Whenever I call PlaySound (using the technique described here:
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_csref/html/f7f62f53-e026-4c40-b221-3a26adb0c2c5.htm) I also get a MissingMethodException.

This time, the Message is 'Can't find PInvoke DLL "winmm.DLL"'.

Up top, I have:
[System.Runtime.InteropServices.DllImport("winmm.DLL", EntryPoint =
"PlaySound", SetLastError = true)]
private static extern bool PlaySound(string szSound, System.IntPtr hMod,
PlaySoundFlags flags);

[System.Flags]
public enum PlaySoundFlags : int {
SND_SYNC = 0x0000,
SND_ASYNC = 0x0001,
SND_NODEFAULT = 0x0002,
SND_LOOP = 0x0008,
SND_NOSTOP = 0x0010,
SND_NOWAIT = 0x00002000,
SND_FILENAME = 0x00020000,
SND_RESOURCE = 0x00040004
}

In the code:
bool ok = false;
if (System.IO.File.Exists(file) == true) {
try {
ok = PlaySound(file, new System.IntPtr(), PlaySoundFlags.SND_SYNC);
} catch (MissingMethodException mme) {
Console.WriteLine(mme.Message);
} catch (Exception e) {
Console.WriteLine(e.Message);
}
}

I am using a WAV file. Any idea what I could be doing wrong this time?

I'm pretty darned good at doing stuff wrong, by the way! :)

"Peter Foot" wrote:

> This API was added in Windows Mobile 6. You can't call it on older devices
> as you'll get this error. You can use PlaySound instead but it is limited to
> .wav files only.
>
> Peter
>
> --
> Peter Foot
> Microsoft Device Application Development MVP
> peterfoot.net | appamundi.com | inthehand.com
> APPA Mundi Ltd - Software Solutions for a Mobile World
> In The Hand Ltd - .NET Components for Mobility
>
> "jp2msft" <jp2msft(a)discussions.microsoft.com> wrote in message
> news:CD217ACB-8861-44B4-A15D-7F705CD736BA(a)microsoft.com...
> >I have added the "aygshell" reference to SndPlaySync to my Pocket PC 2003
> > project using:
> >
> > [code]
> > [DllImport("aygshell.dll", SetLastError = true)]
> > static extern IntPtr SndPlaySync(string Path, uint Flags);
> > [/code]
> >
> > In my code, I try calling SndPlaySync using this code:
> >
> > [code]
> > IntPtr ip;
> > if (System.IO.File.Exists(file) == true) {
> > ip = SndPlaySync(file, 0);
> > }
> > [/code]
> >
> > However, SndPlaySync is throwing this MissingMethodException message:
> >
> > Message="Can't find an Entry Point 'SndPlaySync' in a PInvoke DLL
> > 'aygshell.dll'."
> >
> > How do I fix this?
> >
> > Am I calling the SndPlaySync function incorrectly? Is the DLL reference
> > incorrect? What else could it be?
>
From: Chris Tacke, MVP on
Because it's in coredll.dll, not winmm.dll

-Chris


"jp2msft" <jp2msft(a)discussions.microsoft.com> wrote in message
news:6811128D-FA47-4CF1-AF71-B2F4D2786A9C(a)microsoft.com...
> Rats! VS2005 or Pocket PC didn't like that either.
>
> Whenever I call PlaySound (using the technique described here:
> ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_csref/html/f7f62f53-e026-4c40-b221-3a26adb0c2c5.htm)
> I also get a MissingMethodException.
>
> This time, the Message is 'Can't find PInvoke DLL "winmm.DLL"'.
>
> Up top, I have:
> [System.Runtime.InteropServices.DllImport("winmm.DLL", EntryPoint =
> "PlaySound", SetLastError = true)]
> private static extern bool PlaySound(string szSound, System.IntPtr hMod,
> PlaySoundFlags flags);
>
> [System.Flags]
> public enum PlaySoundFlags : int {
> SND_SYNC = 0x0000,
> SND_ASYNC = 0x0001,
> SND_NODEFAULT = 0x0002,
> SND_LOOP = 0x0008,
> SND_NOSTOP = 0x0010,
> SND_NOWAIT = 0x00002000,
> SND_FILENAME = 0x00020000,
> SND_RESOURCE = 0x00040004
> }
>
> In the code:
> bool ok = false;
> if (System.IO.File.Exists(file) == true) {
> try {
> ok = PlaySound(file, new System.IntPtr(), PlaySoundFlags.SND_SYNC);
> } catch (MissingMethodException mme) {
> Console.WriteLine(mme.Message);
> } catch (Exception e) {
> Console.WriteLine(e.Message);
> }
> }
>
> I am using a WAV file. Any idea what I could be doing wrong this time?
>
> I'm pretty darned good at doing stuff wrong, by the way! :)
>
> "Peter Foot" wrote:
>
>> This API was added in Windows Mobile 6. You can't call it on older
>> devices
>> as you'll get this error. You can use PlaySound instead but it is limited
>> to
>> .wav files only.
>>
>> Peter
>>
>> --
>> Peter Foot
>> Microsoft Device Application Development MVP
>> peterfoot.net | appamundi.com | inthehand.com
>> APPA Mundi Ltd - Software Solutions for a Mobile World
>> In The Hand Ltd - .NET Components for Mobility
>>
>> "jp2msft" <jp2msft(a)discussions.microsoft.com> wrote in message
>> news:CD217ACB-8861-44B4-A15D-7F705CD736BA(a)microsoft.com...
>> >I have added the "aygshell" reference to SndPlaySync to my Pocket PC
>> >2003
>> > project using:
>> >
>> > [code]
>> > [DllImport("aygshell.dll", SetLastError = true)]
>> > static extern IntPtr SndPlaySync(string Path, uint Flags);
>> > [/code]
>> >
>> > In my code, I try calling SndPlaySync using this code:
>> >
>> > [code]
>> > IntPtr ip;
>> > if (System.IO.File.Exists(file) == true) {
>> > ip = SndPlaySync(file, 0);
>> > }
>> > [/code]
>> >
>> > However, SndPlaySync is throwing this MissingMethodException message:
>> >
>> > Message="Can't find an Entry Point 'SndPlaySync' in a PInvoke DLL
>> > 'aygshell.dll'."
>> >
>> > How do I fix this?
>> >
>> > Am I calling the SndPlaySync function incorrectly? Is the DLL reference
>> > incorrect? What else could it be?
>>