By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,198 Members | 1,727 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,198 IT Pros & Developers. It's quick & easy.

How can I play "standard system sounds" in C# ?

P: n/a
Hi !

How can I play "standard system sounds" in C# ?

( "standard system sounds" = The kind of sound you hear when you use MessageBox.Show() )

Thanks !

steph.
Mar 16 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Assuming you are using .NET 2.0 you can use SystemSounds class:

System.Media.SystemSounds.Asterisk.Play();

SystemSounds class also has other members Beep, Hand and Question.
"Steph." wrote:
Hi !

How can I play "standard system sounds" in C# ?

( "standard system sounds" = The kind of sound you hear when you use MessageBox.Show() )

Thanks !

steph

Mar 16 '06 #2

P: n/a
vj

"yogeshprabhu" <yo**********@discussions.microsoft.com> wrote in message
news:E8**********************************@microsof t.com...
Assuming you are using .NET 2.0 you can use SystemSounds class:

System.Media.SystemSounds.Asterisk.Play();

SystemSounds class also has other members Beep, Hand and Question.
"Steph." wrote:
Hi !

How can I play "standard system sounds" in C# ?

( "standard system sounds" = The kind of sound you hear when you use
MessageBox.Show() )

Thanks !

steph

Mar 16 '06 #3

P: n/a
vj
if you are in Framework 1.1... you with interop... chk the link out...

http://pinvoke.net/search.aspx?search=sound&namespace=[All]

VJ
"Steph." <st***@nomail.com> wrote in message news:eo**************@TK2MSFTNGP09.phx.gbl...
Hi !

How can I play "standard system sounds" in C# ?

( "standard system sounds" = The kind of sound you hear when you use MessageBox.Show() )

Thanks !

steph.
Mar 16 '06 #4

P: n/a
Steph,

As VJ pointed out for .NET 1.x besides simple beeps that can be made using Microsoft.VisualBasic.dll (some people have problems referencing this dll in C# application, but it is still a managed assembly installed along with the framework) there is no way playing sounds wihtout resorting to native API and PInvoke.

If you are using .NET1.x and decide to go for native API take a look at the MessageBeep method.
--
HTH
Stoitcho Goutsev (100)
"vj" <vi********@yahoo.com> wrote in message news:e4**************@TK2MSFTNGP12.phx.gbl...
if you are in Framework 1.1... you with interop... chk the link out...

http://pinvoke.net/search.aspx?search=sound&namespace=[All]

VJ
"Steph." <st***@nomail.com> wrote in message news:eo**************@TK2MSFTNGP09.phx.gbl...
Hi !

How can I play "standard system sounds" in C# ?

( "standard system sounds" = The kind of sound you hear when you use MessageBox.Show() )

Thanks !

steph.
Mar 17 '06 #5

P: n/a
This, http://www.codeproject.com/cs/media/PlaySounds1.asp, shows you exactly what you want to know. It is .NET 1.x code, but it is insanely easy in .NET 2.0 to play system sounds. They took out all the Interop fun! ;(

"Steph." <st***@nomail.com> wrote in message news:eo**************@TK2MSFTNGP09.phx.gbl...
Hi !

How can I play "standard system sounds" in C# ?

( "standard system sounds" = The kind of sound you hear when you use MessageBox.Show() )

Thanks !

steph.
Mar 17 '06 #6

P: n/a
vj
Interop fun... uhmmm that is an interesting phase :-)

VJ
"FusionGuy" <sbearusa32 at &emSen& dot com> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl...
This, http://www.codeproject.com/cs/media/PlaySounds1.asp, shows you exactly what you want to know. It is .NET 1.x code, but it is insanely easy in .NET 2.0 to play system sounds. They took out all the Interop fun! ;(

"Steph." <st***@nomail.com> wrote in message news:eo**************@TK2MSFTNGP09.phx.gbl...
Hi !

How can I play "standard system sounds" in C# ?

( "standard system sounds" = The kind of sound you hear when you use MessageBox.Show() )

Thanks !

steph.
Mar 17 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.