Hello I am trying to play an MP3 file with BackgroungWorker.
My playing function is working just fine without the backgroundworker, so why I can't play it like this?
BackgroundWorker bw =newBackgroundWorker();
bw.WorkerReportsProgress=true;
bw.DoWork+=newDoWorkEventHandler(delegate(object o,DoWorkEventArgs args){BackgroundWorker b = o asBackgroundWorker;string path =System.IO.Path.GetFullPath(".../.../sounds/")+"C4"+".mp3";string command;
command ="open \""+ path +"\" type mpegvideo alias fileC4";
mciSendString(command,null,0,IntPtr.Zero);
command ="play all";
mciSendString(command,null,0,IntPtr.Zero);});
bw.RunWorkerCompleted+=newRunWorkerCompletedEventHandler(delegate(object o,RunWorkerCompletedEventArgs args){
label1.Text="HOORAY!";});
bw.RunWorkerAsync();