Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   Winamp Technical Support (http://forums.winamp.com/forumdisplay.php?f=11)
-   -   Constructing a string to launch Winamp via API (http://forums.winamp.com/showthread.php?t=109187)

TerraFed 10th October 2002 03:20

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?

Sawg 10th October 2002 06:54

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"

TerraFed 11th October 2002 05:16

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?

c2R 11th October 2002 08:58

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.

TerraFed 11th October 2002 09:01

But I'm trying to add the file to the play list. I am asking how do I do that.

c2R 11th October 2002 09:49

Quote:

Originally posted by TerraFed
But I'm trying to add the file to the play list. I am asking how do I do that.
You could simply use the shell command (without the execute bit), and use the /ADD parameter.

TerraFed 12th October 2002 04:01

Quote:

Originally posted by c2R


You could simply use the shell command (without the execute bit), and use the /ADD parameter.

Yep, that's the trick. Thanks. :winamp:

c2R 12th October 2002 08:57

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.

TerraFed 14th October 2002 07:55

Quote:

Originally posted by c2R
You might want to consider getting Winamp's path from the registry, if you're not already.

All right, I've tried that. I can't get the value, so obviously I'm doing it wrong. I'm using the VB GetSetting function.

It asks for
AppName
Section
Key

What are the right settings?

Synvb 6th June 2003 22:07

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.