Play Song WMP

Talk2Tom11

Well-known member
Joined
Feb 22, 2004
Messages
144
Location
Westchester, NY
this is my code:

System.Diagnostics.Process.Start("wmplayer.exe", "Help Me.mp3")

it opens Windows Media Player, but the song doesn;t start. I haver the song located in the Bin Folder. Any One Know how to get the song to play?
 
When I used this code with WMP 8 in the computer it worked... but didnt work with WMP 9. It opens media player but does not play the song. Any ideas please help.
 
You have to supply the whole path to file... it wont look in the Bin folder for the file. And then, you have to make sure that the path doesnt have any spaces. (filenames with ~#)
 
It does read from the bin file by default. That is where you have it read text files from, etc. Also this code worked with WMP 8. It just isnt working wit WMP 9.
 
What Im saying is that, when you pass the filename into it like that, the Windows Media Player is going to receive just the filename: "Help Me.mp3"... and it will try to run it... but WMP is running from some other distant folder on the computer (Program Files\Windows Media Player) and when it sees that filename, it probably wont have a clue as to where that file is, unless (maybe) you have it already in your Windows Media Player Library... and I think WMP is smart enough to know where the file is since it has already found it before.
But, thats just a guess... :-\
you may want to look at the [api]GetShortPathName[/api] API, and Environment.CurrentDirectory to get a path name for your song. :)
 
Code:
System.Diagnostics.Process.Start("wmplayer.exe", System.Environment.CurrentDirectory & "Help Me.mp3")

:)
 
Thats because WMP9 is treating the spaces that occur in your filename to be separating the arguments.

Try making the path to your file like this.

System.Diagnostics.Process.Start("wmplayer.exe", "C:\docume~1\talk2t~1\mydocu~1\visual~1\etc~1\HelpMe~1.mp3")
:)
 
Back
Top