Solved

Simple Beep on Windows Mobile

Posted on 2006-11-18
9
6,495 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When I was a beginner in Windows Mobile programming, even for small test I used to create a single MFC dialog-based application with one button, and put my test code in the OnLButtonDown method. For Pocket PC it worked fine, on some Windows CE d…
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…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Suggested Courses

626 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