• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 6662
  • Last Modified:

Simple Beep on Windows Mobile


Hello,

I'm developing a handheld barcode scanning application and have a textbox that accepts the input.  All is well except I would like a simple "beep" after I detect the input.

Is there a simple API call, etc. that can do this?  I don't need anything fancy like playing a wav file, etc.  (Maybe for version 2).

VS 2005 - WM 5.0 - CF 2.0 - C#

Joe
0
jkanisut
Asked:
jkanisut
2 Solutions
 
Mikal613Commented:
try
Beep()
0
 
Mikal613Commented:
c#

Beep();
0
 
Mikal613Commented:
http://msdn2.microsoft.com/en-us/library/8hftfeyw.aspx

Your lucky that you are using the CF2.0
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
jkanisutAuthor Commented:

Getting warmer... do you know how I can get the System.Media namespace into my CF 2.0 app?  It doesn't seem to have a reference.

Joe
0
 
Mikal613Commented:
0
 
CJCraftCommented:
It actually might be easier to play the wav file. :)

Actually you can do the following:
Microsoft.VisualBasic.Interaction.Beep()

You just need to add a reference to Microsoft.VisualBasic.dll in the project.

Or you can p/invoke:

    [DllImport("kernel32.dll")]
    public static extern bool Beep(int freq,int duration);

0
 
jkanisutAuthor Commented:

Thanks... what am I doing wrong in this test program?  Getting:

System.MissingMethodException was unhandled
  Message="Can't find PInvoke DLL 'kernel32.dll'."


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace Beep
{
    public partial class Form1 : Form
    {

        [DllImport("kernel32.dll")]
        public static extern bool Beep(int freq,int duration);


        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Beep(1000,1000);
        }
    }
}

0
 
jkanisutAuthor Commented:

This was a more detailed solution and targeted for the CF:

http://blogs.msdn.com/brada/archive/2004/06/03/148142.aspx
0
 
derunbekannteCommented:
Works in VS08 WM5 CF 2 C#
seems to be alot easier than all that other stuff(which didn't work for me anyway)
System.Media.SystemSounds.Beep.Play();

Open in new window

0

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now