Playing sound while displaying a splash screen?
-
03-07-2019 - |
Question
I want to play a sound while my splash screen gets data from the server.
The sound file is not too large. I want something like when you start your computer you hear the MSWinXP welcome sound and that while establishing your account.
How can I do that?
thnx
Solution
Use System.Media.SoundPlayer
. You may need to put this code in Form_Load instead.
private void button1_Click(object sender, EventArgs e)
{
System.Media.SoundPlayer player = new System.Media.SoundPlayer();
player.SoundLocation = @"C:\Windows\Media\chimes.wav";
player.Play();
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow