Link to home
Start Free TrialLog in
Avatar of Ludo_Dirckx
Ludo_Dirckx

asked on

Creating beep on pocket pc

Hello,
I am using win mobil 2003 se and developing web service applications on it.
Once the application connects to the gerver and get an delivery-order from the server the driver who is using the pda should get an sound alert.
I was trying to get some code, it uses the win dll import.
It is working on the desktop but not on the pocket pc.
I attach the code bellow.
Can anyone give me an idea why it is not working.
Do we have the same dll in the pda also(kernel32.dll).
I call this class from my main form.

using System;
using System.Runtime.InteropServices;
namespace EKS_comsy
{
     public class BeepProcess
    {
       [DllImport("kernel32.dll")]
       public static extern bool Beep(int frequency, int duration);
         public BeepProcess()
          {
             Random random = new Random();
             for (int i = 0; i < 10; i++)
              {
               Beep(random.Next(10000), 5);
              }
           }
      }
}



thanks in advance.
ASKER CERTIFIED SOLUTION
Avatar of SweetsGreen
SweetsGreen

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ludo_Dirckx
Ludo_Dirckx

ASKER

Hi SweetsGreen,
Thenks for the reply.
I tried the way how you wrote.
My main test form i have a button and i say,

private void btnPlaySound_Click(object sender, System.EventArgs e)
{
 BeepTest.Class1 newSound = new Class1();
 newSound.play();
 }

In my playsound class

using System;
using System.Runtime.InteropServices;
namespace BeepTest
{
     public Class1
    {
     [DLLImport("coredll.dll")];
      public static extern int MessageBeep (int frequency, int duration);
         public void play()
          {
             Random random = new Random();
             for (int i = 0; i < 10; i++)
              {
               MessageBeep(random.Next(10000), 5);
              }
           }
      }
}

This code is working fine on the emulator but i do not hear any sound on the pocket pc.
I do not get any error too.
just i do not hear the sound. My sound setting is maximum.
I could not figur it out.

hlep me please.

thanks.

Hi It works,
In my sounds and Notifications i enabled the Enable sounds for Events (Warnings, System events)
Thanks.