从深度历险上摘抄的操纵winamp的完整程序
未经测试)
unit WinAmpInterface;
interface
uses
WAIPC,Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
FileCtrl, RzFilSys, StdCtrls, Spin, Buttons, ExtCtrls;
type
TForm1 = class(TForm)
RzDriveComboBox1: TRzDriveComboBox;
RzDirectoryListBox1: TRzDirectoryListBox;
RzFileListBox1: TRzFileListBox;
FileSelected: TEdit;
LaunchWinAmp: TButton;
AddToPlayList: TButton;
SpinButton1: TSpinButton;
Volume: TLabel;
Rewind5Sec: TBitBtn;
Forward5Sec: TBitBtn;
RewindForward: TLabel;
Mute: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button1: TButton;
ShowPlayList: TButton;
ShowEq: TButton;
SongLength: TEdit;
AlwaysOT: TButton;
WinAmpDir: TEdit;
PathToWinAmp: TLabel;
PathToMp3z: TLabel;
PathToMP3: TEdit;
Me: TLabel;
DeletePL: TButton;
Status: TEdit;
JumpTime: TEdit;
Jump: TButton;
Timer1: TTimer;
TimeElapsed: TLabel;
SLSec: TLabel;
StatusLabel: TLabel;
TimeRemaining: TEdit;
procedure RzFileListBox1Click(Sender: TObject);
procedure LaunchWinAmpClick(Sender: TObject);
procedure AddToPlayListClick(Sender: TObject);
procedure SpinButton1DownClick(Sender: TObject);
procedure SpinButton1UpClick(Sender: TObject);
procedure MuteClick(Sender: TObject);
procedure Rewind5SecClick(Sender: TObject);
procedure Forward5SecClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure ShowPlayListClick(Sender: TObject);
procedure ShowEqClick(Sender: TObject);
procedure TimeRemainClick(Sender: TObject);
procedure SongLengthmsClick(Sender: TObject);
procedure AlwaysOTClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure PathToMP3Exit(Sender: TObject);
procedure DeletePLClick(Sender: TObject);
procedure StatusBClick(Sender: TObject);
procedure JumpClick(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.RzFileListBox1Click(Sender: TObject);
begin
FileSelected.text:=rzFileListBox1.LongFileName;
end;
procedure TForm1.LaunchWinAmpClick(Sender: TObject);
Var Mp3ToLaunch:string;
p
char;
begin
MP3ToLaunch:=WinAmpDir.text+' '+FileSelected.text;
Mp3ToLaunch:=MP3ToLaunch+#0;
{ makes string null -terminated }
p:=@MP3ToLaunch[1];
{ skip s[0], as it contains length }
WinExec(p,Sw_normal);
end;
procedure TForm1.AddToPlayListClick(Sender: TObject);
begin
AddMp3ToPlayList(FileSelected.Text);
end;
procedure TForm1.SpinButton1DownClick(Sender: TObject);
begin
VolumeDown;
end;
procedure TForm1.SpinButton1UpClick(Sender: TObject);
begin
VolumeUp;
end;
procedure TForm1.MuteClick(Sender: TObject);
Var x:integer;
begin
For x:=1 to 25do
VolumeDown;
end;
procedure TForm1.Rewind5SecClick(Sender: TObject);
begin
Rewind5;
end;
procedure TForm1.Forward5SecClick(Sender: TObject);
begin
Forward5;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
WAIPC.button1;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
WAIPC.button2;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
WAIPC.button3;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
WAIPC.button4;
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
WAIPC.button5;
end;
procedure TForm1.ShowPlayListClick(Sender: TObject);
begin
PlayList;
end;
procedure TForm1.ShowEqClick(Sender: TObject);
begin
EQ;
end;
procedure TForm1.TimeRemainClick(Sender: TObject);
begin
timeremaining.text:=inttostr(GetOutPutTime(0));
end;
procedure TForm1.SongLengthmsClick(Sender: TObject);
begin
SongLength.text:=inttostr(GetOutPutTime(1));
end;
procedure TForm1.AlwaysOTClick(Sender: TObject);
begin
AlwaysOnTop;
end;
procedure TForm1.FormActivate(Sender: TObject);
begin
RzDirectoryListBox1.directory:=PathToMp3.text;
end;
procedure TForm1.PathToMP3Exit(Sender: TObject);
begin
RzDirectoryListBox1.directory:=PathToMp3.text;
end;
procedure TForm1.DeletePLClick(Sender: TObject);
begin
DeletePlayList;
end;
procedure TForm1.StatusBClick(Sender: TObject);
Var statusi:integer;
begin
statusi:=PlayBackStatus;
Case Statusi of
1: Status.Text:='Playing';
3: Status.Text:='Paused';
0: Status.text:='Stopped';
end;
end;
procedure TForm1.JumpClick(Sender: TObject);
var jumpsuccess: integer;
begin
jumpsuccess:=JumpToTime(StrToInt(jumptime.text)*1000);
end;
procedure TForm1.Timer1Timer(Sender: TObject);
Var statusi:integer;
begin
statusi:=PlayBackStatus;
Case Statusi of
1: begin
Status.Text:='Playing';
timeremaining.text:=inttostr(GetOutPutTime(0)div 1000);
SongLength.text:=inttostr(GetOutPutTime(1));
end;
3: Status.Text:='Paused';
0: Status.text:='Stopped';
end;
end;
end.