Gold
Gold

Reputation: 62424

beep in WinCE , it possible ?

is it possible to make beep in WinCE ?

i try and i get an error

Upvotes: 5

Views: 13654

Answers (5)

Tahir FEYZIOGLU
Tahir FEYZIOGLU

Reputation: 99

in farmework 3.5 posibble.

My solution for generate diffrent sound.

    Beep()
    Threading.Thread.Sleep(100)
    Beep()
    Threading.Thread.Sleep(300)
    Beep()

Upvotes: 0

zomf
zomf

Reputation: 1299

If you're looking to play one of the default system sounds and using .net runtime 2.0+ (and framework v 3.5+), then you can use the System.Media.SystemSounds class (no need for PInvoke or WinAPI calls), like so:

//available system sounds
System.Media.SystemSounds.Asterisk.Play();
System.Media.SystemSounds.Beep.Play();
System.Media.SystemSounds.Exclamation.Play();
System.Media.SystemSounds.Hand.Play();
System.Media.SystemSounds.Question.Play();

Note that the user won't hear anything if they have disabled or muted system sounds.

However, if you are looking to play an arbitrary tone, then the above answers involving WinAPI or PInvoke are what you need to look at.

Upvotes: 4

JaredPar
JaredPar

Reputation: 754505

The .net framework methods for beeing are not available in the CF version of the framework. The best way to get a beep sound is to PInvoke into the MessageBeep function. The PInvoke signature for this method is pretty straight forward

[DllImport("CoreDll.dll")]
public static extern void MessageBeep(int code);

public static void MessageBeep() {
  MessageBeep(-1);  // Default beep code is -1
}

This blog post has an excellent more thorough example: http://blog.digitforge.com/?p=4 (on archive.org)

Upvotes: 11

Justin Emlay
Justin Emlay

Reputation: 905

For a simple beep in Compact Framework you don't need all that import nonsense. Besides, depending on the hardware you'll only have access to the default beep anyway. Just use:

Microsoft.VisualBasic.Interaction.Beep()

Upvotes: 0

ctacke
ctacke

Reputation: 67168

Yes. P/Invoke PlaySound or sndPlaySound or MessageBeep. See this or this or this. It's amazing what 30 seconds with a search engine can turn up.

Upvotes: 6

Related Questions