Petr
Petr

Reputation: 569

C# - Console.Beep does not work on Windows Vista

When I tried Console.Beep() on Win Vista (64bit), it just does not work. The speaker itself is OK, when the PC starts, it beeps. Any advice? Thanks!

Upvotes: 6

Views: 5330

Answers (4)

Abel
Abel

Reputation: 57159

As others have suggested, the Console.Beep() does not work on 64 bit windows as the documentation states. Instead, you can use the following statement that issues a beep (but not through the Beep API):

// beep
System.Media.SystemSounds.Beep.Play();

Workaround originally found here at MSDN Connect.

Upvotes: 1

Scott Chamberlain
Scott Chamberlain

Reputation: 127543

As everyone else has posted pc speaker Beep is not supported in 64x of windows vista or XP and not at all in windows 7. Here is a blog posting from Microsoft explaining why

http://blogs.msdn.com/b/larryosterman/archive/2010/01/04/what-s-up-with-the-beep-driver-in-windows-7.aspx

Upvotes: 2

Hans Olsson
Hans Olsson

Reputation: 55009

Is it 64 bit Vista?

Console.Beep calls the API function Beep which isn't supported on 64bit Vista.

Quote: Windows Vista x64 and Windows XP 64-Bit Edition: This function is not supported.

You might be able to use MessageBeep instead if it's ok with the beep coming through the speakers instead of straight from the motherboard. See here for how to call this from C#.

Upvotes: 10

Jamie
Jamie

Reputation: 1092

the Beep method is not supported on Vista/XP x64. I suppose you do have 64-bit OS?

Upvotes: 2

Related Questions