-Is it installed
private
procedure ListFiles(D,Name,SearchName : String);
procedure TForm1.ListFiles(D,Name,SearchName : String);
var
SR : TSearchRec;
begin
If D[Length(D)]<>'\' then
D:=D+'\';
If FindFirst(D+Name,faAnyFile,SR)=0then
Repeat
If (SR.Attr<>faDirectory) and (SR.Name[1]<>'.') then
If AnsiUpperCase(SR.Name)=AnsiUpperCase(SearchName) then
Label1.Caption:='Winamp installed on system in: ' + D+SR.Name;{If found then set label1.caption}
Until (FindNext(SR)<>0);
FindClose(SR);
If FindFirst(D+'*.*',faDirectory,SR)=0 then
begin
Repeat
If ((Sr.Attr and faDirectory)=faDirectory) and
(SR.Name[1]<>'.') then
ListFiles(D+SR.Name+'\',Name,SearchName);
Until (FindNext(SR)<>0);
end;
FindClose(SR);
end;
procedure TForm1.Button11Click(Sender: TObject);
begin
ListFiles('c:\','*.*','winamp.exe');
end;
----------------------------------------------------------------------
-open winamp
ShellExecute(handle, 'open', pchar('c:\progra~1\winamp\winamp.exe'), nil, nil, SW_SHOWNORMAL);
or to be a bit more sneaky you can use SW_HIDE
----------------------------------------------------------------------
-play song
procedure TForm1.Button1Click(Sender: TObject);
var
hwndWinamp : THandle;
begin
hwndWinamp := FindWindow('Winamp v1.x', nil);
SendMessage(hwndWinamp, WM_COMMAND, 40045, 0);
end;
----------------------------------------------------------------------
-pause/unpause song
procedure TForm1.Button1Click(Sender: TObject);
var
hwndWinamp : THandle;
begin
hwndWinamp := FindWindow('Winamp v1.x', nil);
SendMessage(hwndWinamp, WM_COMMAND, 40046, 0);
end;
----------------------------------------------------------------------
-stop song
procedure TForm1.Button1Click(Sender: TObject);
var
hwndWinamp : THandle;
begin
hwndWinamp := FindWindow('Winamp v1.x', nil);
SendMessage(hwndWinamp, WM_COMMAND, 40047, 0);
end;
----------------------------------------------------------------------
-fast forward
procedure TForm1.Button1Click(Sender: TObject);
var
hwndWinamp : THandle;
begin
hwndWinamp := FindWindow('Winamp v1.x', nil);
SendMessage(hwndWinamp, WM_COMMAND, 40048, 0);
end;
----------------------------------------------------------------------
-rewind
procedure TForm1.Button1Click(Sender: TObject);
var
hwndWinamp : THandle;
begin
hwndWinamp := FindWindow('Winamp v1.x', nil);
SendMessage(hwndWinamp, WM_COMMAND, 40044, 0);
end;
----------------------------------------------------------------------
-fast forward 5 seconds
procedure TForm1.Button1Click(Sender: TObject);
var
hwndWinamp : THandle;
begin
hwndWinamp := FindWindow('Winamp v1.x', nil);
SendMessage(hwndWinamp, WM_COMMAND, 40148, 0);
end;
----------------------------------------------------------------------
-rewind 5 seconds
procedure TForm1.Button1Click(Sender: TObject);
var
hwndWinamp : THandle;
begin
hwndWinamp := FindWindow('Winamp v1.x', nil);
SendMessage(hwndWinamp, WM_COMMAND, 40144, 0);
end;
----------------------------------------------------------------------
-volume up
procedure TForm1.Button1Click(Sender: TObject);
var
hwndWinamp : THandle;
begin
hwndWinamp := FindWindow('Winamp v1.x', nil);
SendMessage(hwndWinamp, WM_COMMAND, 40058, 0);
end;
----------------------------------------------------------------------
-volume down
procedure TForm1.Button1Click(Sender: TObject);
var
hwndWinamp : THandle;
begin
hwndWinamp := FindWindow('Winamp v1.x', nil);
SendMessage(hwndWinamp, WM_COMMAND, 40059, 0);
end;
----------------------------------------------------------------------
-close winamp
procedure TForm1.Button1Click(Sender: TObject);
var
hwndWinamp : THandle;
begin
hwndWinamp := FindWindow('Winamp v1.x', nil);
SendMessage(hwndWinamp, WM_COMMAND, 40001, 0);
end;
----------------------------------------------------------------------