0

I use ShellExecute from Delphi to open VLC media player to play songs. Sometimes it works and sometimes it fails (For one song it works and for most doesn't). When it fails it displays a few msgs (for each failure) - notifying that it failed to open the file (which exists for sure!). Each msg shows a different file name it looks for. For each file that it fails it shows segments of the file name, which of course it not a proper name. Looks as if it tries to open the file a few times, but each tine the file name is incorrect. I read through other ShellExecute problems and none helped. But someone answered "Dont forget to wait with the file" (or something like that.) I use ShellExecute to open youtube and it works fine. Thanks a lot!!!! Aviella Angel

  • Showing the error messages would allow us a chance at solving the problem. At the moment you're asking us what color the walls are painted in a room with no light or windows... – EWit Aug 10 '14 at 10:41
  • The error msg is that VLC can't open the file. In the meantime I fount out that file names that conatain spaces were not able to open while other which had no spaces in the name were opened. Any idea how to solve this? – user3925424 Aug 12 '14 at 05:50
  • Most often you should just put quotes around the name containing spaces to make another program interpret it as a single argument in stead of multiple. so `vlc "filename with spaces"` or something like that I guess. – EWit Aug 12 '14 at 07:28
  • The Api call is ShellExecute(Handle,'open',pchar(app),pchar(FileName),nil, SW_SHOWNORMAL) ; and the file name is null-terminated string defined by pchar(FileName). I dont see how I can add quotes. – user3925424 Aug 12 '14 at 09:28
  • Can someone explain how to add the quotes? The var in Delphi is of string type and I cast it to pchar(FileName) when I cll ShellExecute. Where do I add the quotes?? – user3925424 Aug 14 '14 at 19:01
  • http://stackoverflow.com/questions/13414496/how-do-you-pass-parameters-containing-spaces-in-vbs Does that help? – EWit Aug 14 '14 at 19:03
  • Sorry, it doesnt help. 1. I dont know what is UAC and I dont think it is relevant because VLC opens correctly when file name has no spaces. 2. I work in Delphi (pascal) and I have no idea how to use quotes as part of the paramater (the file name) – user3925424 Aug 16 '14 at 06:32

0 Answers0