Pages

Saturday, 11 August 2012

How to play alert/beep sound on console application.




For Console Application:

 Just used  "\a" for alert.
    Code:
    Console.Write("\a Your name please : ");
    string @MyString = Console.ReadLine();
    Console.Write(@MyString);














FOR WINDOWS APPLICATION:

Limitation : Only for *.wav files
Code:
private void playSimpleSound()
{
    SoundPlayer simpleSound = new SoundPlayer(@"c:\Windows\Media\chimes.wav");
    simpleSound.Play();
}

















No comments:

Post a Comment