Hello,
I am developing a small application that should allow for (among others) to perform all actions on windows explorer files (actions that can be accessed by right clicking on a file in Explorer, for example " open "," edit ", etc).
But I have a problem when it comes to open multiple files at the same time. In this case, I rely on the "Play in Winamp" on files. Mp3.
In the registry, this action corresponds to the following:
"C: \ Program Files \ Winamp \ winamp.exe" "% 1"
% 1 is replaced by the file name.
I am pretty sure that the windows explorer, when several are selected mp3, execute this command for each file. It then winamp which will in turn detect that it is executed several times within a time "very short" to create a single playlist with the files. (And not a single file in the playlist in the end, therefore, as the parameter "% 1" is always one of the selected files).
I code my application in C #. At first I tried to parse the registry key, use Process.Start with winamp as a program and the name of a file as an argument (by repeating the call for all selected files).
But problem # 1: it works, but the files are not in order in the playlist. This comes from the fact (I think) only when it starts another process, we have no control over scheduling, and thus the various winamp generated playlist in an unexpected order.
Then I tried to use the ShellExecute (which comes from shell32.dll). I pass parameter in the "play" (as recorded in the register), and the name of a mp3 file path, and I called once per file.
But problem # 2: I find myself in case the final winamp is open only with the last file in the list. Apparently ShellExecute waiting for the program switches to where he gets the message windows before returning, so take my winamp calls for separate calls (as if the mp3 was launched by hand one after the other: in the end it was more than the last file in the playlist).
My question is to solve one of two problems: either pass to "order" creative process via successive calls to my Process.Start or succeed to use ShellExecute to start a list of files. I tried various methods of calling to enter path and not a file, but a list of file, but each time the method returns ShellExecute me a code 2 (file not found). What I have tested include:
"file1" "file2" ...
"file1" "file2", ...
"file1" "file2"; ...
I prefer to use the ShellExecute method, which is easier to generalize that Process.Start (because the parser registry keys may not function keys for a bit exotic).
Thank you.
Bookmarks