Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 6712
  • 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
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

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