I want to have a checkbox that can enable/disable background music in my winforms application. I found out how to load a specific file from a directory with openfiledialog and such but that was bad, so I did this (worked on my pc):
if (checkBox7.Checked == true)
{
System.Media.SoundPlayer player = new System.Media.SoundPlayer();
player.SoundLocation = "PATH";
player.Load();
player.Play();
}
But how in the world do I get it to work on other computers? I know I could put an mp3 file inside the same folder with the program, and send that folder to another person. But I've seen programs where the mp3/wav (or whatever) is built-in inside the application and there's only an exe file.
An example are those "keygenerators" for different applications like Sony Vegas. How did he include the audio file inside the program?
Could anyone help? I tried adding a wav file to the resources and then use that as path, but it's not possible for some reason...?
path would be for example: MyProgram.Properties.Resources.Song
but I could not add .wav or .mp3 at the end, so it can't load the file.
Any help is appreciated! I want the sound to be in background and hidden, no media player showing and so on. And no "browse file" button. I just want it to load my song automatically which should be included inside the program in some way.