PDA

View Full Version : ShellExecute



Septimus
24-07-2003, 09:19 AM
I just realised that I probably should be posting all these problems here :oops:

I've hit another snag with my music seek & play program - enqueueing (whoah?) in winamp.
I'm assuming that using the ShellExecute procedure would be the way to go, so I'm working with that. I've got it to play files alright by just executing the filename, which starts the default player with the list of songs selected. But how to you use ShellExecute to start a program with parameters? Here's my code:

WinAmpLoc := 'F:\Program Files\Winamp\winamp.exe';
(I had trouble getting the location from the registry. Is it possible to read the (Default) key?)
Output = the TListView with the list of songs;
the winamp command to enqueue songs is winamp.exe /ADD <song>



procedure TForm1.EnqueueClick&#40;Sender&#58; TObject&#41;;
var i&#58; Integer;
Song&#58; String;
begin
for i &#58;= 0 to &#40;Output.Items.Count - 1&#41; do
begin
if Output.Items.Item&#91;i&#93;.Checked then begin
Song &#58;= 'E&#58;\Music\' + Output.Items.Item&#91;i&#93;.Caption;
ShellExecute&#40;Handle,'open',PChar&#40;WinAmpLoc&#41;,PChar&#40; ' /ADD ' + Song&#41;,nil,SW_SHOWNORMAL&#41;;
end;
end;
end;


This loads winamp and plays whatever song is already queued (the demo if none). Actually it does a bunch of different things depending on what winamp is already doing. But the important thing is, it does everything except what I want it to do :evil:

Septimus
24-07-2003, 09:40 AM
Nevermind, I just got it working :D
Does anyone know how to clear a winamp queue? I'll have a look around, but figured since you're here anyway I might as well make use of your time.

Also how do I change my colours in the pascal BBCode?

Eriken
24-07-2003, 09:49 AM
Hi Septimus

Take a look at this component on torry.net, it might answer all your questions about Winamp-stuff atleast :-)

http://homepages.borland.com/torry/vcl/mmedia/other/istwacomp.zip

If it's old compared to your Winamp there are quite alot of other winamp-solutions at that site so it shouldn't be too difficult to find something updated.
_____
Eriken

Septimus
24-07-2003, 05:24 PM
Cool, thanks. I'm a firm believer than one can never have enough components :D

Eriken
24-07-2003, 05:47 PM
Somehow, having too much other components in my own programming always tends to be a mess.. But atleast we can learn something from i.e. the component I showed you a link to, and then make our own ;-)

I think there is a website for winamp where it shows you what you must do to get it working from another application, but finding some delphi-stuff on Torry was just that much easier ;)
_____
Eriken