Solved

Simple Beep on Windows Mobile

Posted on 2006-11-18
9
6,306 Views
Last Modified: 2013-12-27

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
Comment
Question by:jkanisut
9 Comments
 
LVL 48

Expert Comment

by:Mikal613
ID: 17973053
try
Beep()
0
 
LVL 48

Assisted Solution

by:Mikal613
Mikal613 earned 200 total points
ID: 17973054
c#

Beep();
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 17973055
http://msdn2.microsoft.com/en-us/library/8hftfeyw.aspx

Your lucky that you are using the CF2.0
0
 
LVL 1

Author Comment

by:jkanisut
ID: 17982915

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 48

Expert Comment

by:Mikal613
ID: 17983369
0
 
LVL 7

Accepted Solution

by:
CJCraft earned 300 total points
ID: 18202656
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
 
LVL 1

Author Comment

by:jkanisut
ID: 18202902

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
 
LVL 1

Author Comment

by:jkanisut
ID: 18204268

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

http://blogs.msdn.com/brada/archive/2004/06/03/148142.aspx
0
 

Expert Comment

by:derunbekannte
ID: 24244790
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface: This article is part of a series focused on cross platform mobile app development (specifically Android and iOS) using the Alloy framework and Titanium Studio made by Appcelerator (https://www.appcelerator.com/). This article presumes a wor…
A short article about problems I had with the new location API and permissions in Marshmallow
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now