![]() |
Constructing a string to launch Winamp via API
Okay, I know the /NEW command line parameters to launch Winamp and add a file to the play list. But I can't seem to build the correct string to pass to the file parameter of ShellExecuteX function.
Here's a sample: C:\Program Files\Winamp\winamp.exe /ADD "D:\MP3\Audio\Rock\George Harrison\1987 - Cloud Nine\06 When We Was Fab.mp3" I get a message that Windows can't find the specified file? What am I doing wrong? |
Put quotes around the Winamp path )because of the space)
"C:\Program Files\Winamp\winamp.exe" /ADD "D:\MP3\Audio\Rock\George Harrison\1987 - Cloud Nine\06 When We Was Fab.mp3" |
1 Attachment(s)
Nope.
Here's what I'm doing. chr(34) & "C:\Program Files\Winamp\winamp.exe" & chr(34) & " /ADD " & chr(34) & "D:\MP3\Audio\Rock\Tom Petty & The Heartbreakers\2002 - The Last DJ\01_The Last DJ.mp3" & chr(34) Shouldn't this work? |
Isn't the whole point of shell execute to open the file with it's default associated program? So surely you just need to shell ex the mp3 file itself, without bothering with the winamp path or anything.
If you were trying to do it your way, a simple shell should work - but it's not advised, as everyone using the program would always have to ensure they had winamp and that it was installed in the same place. |
But I'm trying to add the file to the play list. I am asking how do I do that.
|
Quote:
|
Quote:
|
You might want to consider getting Winamp's path from the registry, if you're not already.
This will allow the end user to run the program even if Winamp is installed in a different directory to default. |
Quote:
It asks for AppName Section Key What are the right settings? |
If you noticed, the ShellExecute API call has these arguments:
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long This allows you to execute a program, passing parameters to it. This is what you need to do in order to add a song to the playlist: Call ShellExecute(Me.hwnd, "open", "C:\Program Files\Winamp\winamp.exe", "/ADD " & Chr(34) & "D:\MP3\Audio\Rock\George Harrison\1987 - Cloud Nine\06 When We Was Fab.mp3" & Chr(34), App.Path, 0&) This should work, as this is how the ShellExecute call is supposed to be used. |
| All times are GMT. The time now is 11:49. |
Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.