winamp的问题(200分)

  • 主题发起人 主题发起人 yyhhnn
  • 开始时间 开始时间
Y

yyhhnn

Unregistered / Unconfirmed
GUEST, unregistred user!
怎样获取当前WINAMP所播放的MP3名称?自己程序中怎样控制WINAMP启动,播放,暂停指定
MP3??

以上问题即怎样和WINAMP实时通讯??
 
MMtools控件组 有直接控件
 
MMtools在哪里有???

如果不用控件,怎么写代码?
 
怎么没有人回答啊???????可以加分的
 
TO:房客
mmtools 控件组哪儿有下????
或是发给我 yuanhn@263.net


给点人气好吗??

怎样获取当前WINAMP所播放的MP3名称?自己程序中怎样控制WINAMP启动,播放,暂停指定
MP3??

以上问题即怎样和WINAMP实时通讯??




 
http://202.38.71.139/mirrors/87.16/BOOK/rich/Q0058715.htm
 
MMTOOLS 多媒体 Delphi 元件包: http://www.swiftsoft.de/index.html,
要在Delphi中编写多媒体软件,此包必备!就是太贵了!&^$@^%
 
我从网站上下了一个MMTOOLS控件,安装后一切正常并没有什么注册啊,是不是编的程序会有问题??
还有,这个控件怎么用啊??怎样用这个控件实现我上述的要求了?

还有没有别的简单一点的控件??????

或者有没有高手直接指点代码了??


 
winamp是使用sendmessage之类的方法直接控制的
我也是看了控件的代码才知道的
winamp站也有详细说明

但我不知道怎样取得播放列表
印象中是可以的

先用FindWindow找句柄
再send/post message

我发email吧
 
to:MrMengy

好啊,我的EMAIL: yuanhn@263.net

怎样取得当前WINAMP的播放列表了??
外部程序(不是PLUGIN)怎样取得WINAMP当前正在播放的MP3的文件(不是TITLE)名称和路径了??
 
www.csdn.net上有这种组件
 
用这个单元你就可以控制了
几乎所有功能都能控制
namegm能得到播放歌曲的名称
我加上去的

(* This unit will allow control of Nullsofts awesome Mp3 Player
* Winamp from within Delphi 3 Applications (it will probably work with
* Delphi 2 but I have not tried it). This unit is FREEWARE if you like
* it or have any questions about it let me know emslie@gpu.srv.ualberta.ca
*
*)

unit WAIPC;

interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
FileCtrl, StdCtrls, Spin;

Const
{WM_WA_IPC = WM_USER;}
IPC_GETVERSION = 0;
IPC_PLAYFILE = 100;
IPC_DELETE = 101;
IPC_STARTPLAY = 102;
IPC_CHDIR = 103;
IPC_ISPLAYING = 104;
IPC_GETOUTPUTTIME = 105;
IPC_JUMPTOTIME = 106;
IPC_WRITEPLAYLIST = 120;

WINAMP_OPTIONS_EQ = 40036;
WINAMP_OPTIONS_PLEDIT = 40040;
WINAMP_VOLUMEUP = 40058;
WINAMP_VOLUMEDOWN = 40059;
WINAMP_FFWD5S = 40060;
WINAMP_REW5S = 40061;
WINAMP_BUTTON1 = 40044;
WINAMP_BUTTON2 = 40045;
WINAMP_BUTTON3 = 40046;
WINAMP_BUTTON4 = 40047;
WINAMP_BUTTON5 = 40048;
WINAMP_BUTTON1_SHIFT = 40144;
WINAMP_BUTTON2_SHIFT = 40145;
WINAMP_BUTTON3_SHIFT = 40146;
WINAMP_BUTTON4_SHIFT = 40147;
WINAMP_BUTTON5_SHIFT = 40148;
WINAMP_BUTTON1_CTRL = 40154;
WINAMP_BUTTON2_CTRL = 40155;
WINAMP_BUTTON3_CTRL = 40156;
WINAMP_BUTTON4_CTRL = 40157;
WINAMP_BUTTON5_CTRL = 40158;
WINAMP_PREVSONG = 40198;
WINAMP_FILE_PLAY = 40029;
WINAMP_OPTIONS_PREFS = 40012;
WINAMP_OPTIONS_AOT = 40019;
WINAMP_HELP_ABOUT = 40041;



Procedure GetVersion;
{IPC_GETVERSION is sent to the window, and the return value is the version
Version 1.55 = 0x1551
Version 1.6b = 0x16A0
Version 1.60 = 0x16AF
Version 1.61 = 0x16B0
Version 1.62 = 0x16B1
Version 1.64 = 0x16B3
Version 1.666 = 0x16B4
Version 1.69 = 0x16B5
Version 1.70 = 0x1700
Version 1.72 = 0x1702
Version 1.72 = 0x1703
the command_data parameter is 0. }

procedure AddMp3ToPlayList(mp3ToAdd:string);
Procedure DeletePlayList;
Procedure StartPlay;
Procedure ChangeDir(DirToChangeTo:string);
function namegm:string;
// 得到当前歌曲名称
Function PlayBackStatus : integer;
{ IPC_ISPLAYING returns the status of playback.
If it returns 1, it is playing. if it returns 3, it is paused, if it returns 0, it is not playing.
If it returns something other than 1,3,or 0, something is screwed.
}

Function GetOutPutTime( x : integer): Integer;
{ IPC_GETOUTPUTTIME returns the position in milliseconds of the
current song (lParam = 0), or the song length, in seconds (lParam = 1).
Returns -1 if not playing or error.}
function JumpToTime(new_song_pos:integer):integer;
{ *ONLY AVAILABLE IN v1.60+*
IPC_JUMPTOTIME sets the position in milliseconds of the current song (approximately)
Returns -1 if not playing, 1 on eof, or 0 if successful }
Function WritePlaylist : Integer;
{ *ONLY AVAILABLE IN v1.666+*
IPC_WRITEPLAYLIST writes the current playlist to <winampdir>//Winamp.pl }

// THESE MIGHT CHANGE in the future :)
//Also, you can send standard WM_COMMAND messages to the Winamp window (for other controls), including
// Send using SendMessage(hwnd_winamp,WM_COMMAND,WINAMP_OPTIONS_EQ/*orwhatever*/,0);

Procedure EQ;
// toggles the EQ window
Procedure PlayList;
// toggles the playlist window
Procedure VolumeUp;
// turns the volume up a little
Procedure VolumeDown;
// turns the volumedo
wn a little
Procedure Forward5;
// fast forwards 5 seconds
Procedure Rewind5;
// rewinds 5 seconds

// the following are the five main control buttons, with optionally shift or control pressed
// (for the exact functions of each, just try it out)
Procedure Button1;
Procedure Button2;
Procedure Button3;
Procedure Button4;
Procedure Button5;
Procedure Button1_Shift;
Procedure Button2_Shift;
Procedure Button3_Shift;
Procedure Button4_Shift;
Procedure Button5_Shift;
Procedure Button1_CTRL;
Procedure Button2_CTRL;
Procedure Button3_CTRL;
Procedure Button4_CTRL;
Procedure Button5_CTRL;
Procedure PrevSong;
// always goes to the previous song (unlike button 1), 1.666+
Procedure PopUpLoadFile;
// pops up the load file(s) box
Procedure PopUpPreferences;
// pops up the preferences
Procedure AlwaysOnTop;
// toggles always on top
Procedure PopUpAboutBox;
// pops up the about box :)

implementation

Var hWnd_WinAmp : hWnd;

Procedure GethWnd_WinAmp;
begin

hwnd_winamp := FindWindow('Winamp v1.x', nil);
end;


function namegm:string;
var
szText: array[0..254] of char;
begin

{ GetWindowText(FindWindow('Winamp v1.x', nil),@szText,254);
name:=Strpas(@szText);
}
If GetWindowText(hwnd_winamp,@szText,255)>0 then

namegm:=Strpas(@szText);
end;


Procedure GetVersion;
begin
{
IPC_GETVERSION is sent to the window, and the return value is the version
Version 1.55 = 0x1551
Version 1.6b = 0x16A0
Version 1.60 = 0x16AF
Version 1.61 = 0x16B0
Version 1.62 = 0x16B1
Version 1.64 = 0x16B3
Version 1.666 = 0x16B4
Version 1.69 = 0x16B5
Version 1.70 = 0x1700
Version 1.72 = 0x1702
Version 1.72 = 0x1703
the command_data parameter is 0.
so,
if (SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETVERSION) != 0x1551)
MessageBox(NULL,"Error, Winamp 1.55 not found","Warning",MB_OK);
}end;


procedure AddMp3ToPlayList(mp3ToAdd:string);
Var
x : integer;
begin

Mp3ToAdd:=MP3ToAdd+#0;
GethWnd_WinAmp;
for x:=0 to Length(MP3ToAdd)do

PostMessage(hwnd_winamp,wm_user,ord(mp3toadd[x]),IPC_PLAYFILE);
PostMessage(hwnd_winamp,wm_user,0,IPC_PLAYFILE);
end;


Procedure DeletePlayList;
begin

GethWnd_WinAmp;
SendMessage(hwnd_winamp,WM_USER,0,IPC_DELETE);
end;


Procedure StartPlay;
begin

GethWnd_WinAmp;
SendMessage(hwnd_winamp,WM_USER,0,IPC_STARTPLAY);
end;


Procedure ChangeDir(DirToChangeTo:string);
Var
x : integer;
begin

DirToChangeTo:=DirToChangeTo+#0;
GethWnd_WinAmp;
for x:=0 to Length(DirToChangeTo)do

PostMessage(hwnd_winamp,wm_user,ord(DirToChangeTo[x]),IPC_CHDIR);
PostMessage(hwnd_winamp,wm_user,0,IPC_CHDIR);
end;


Function PlayBackStatus : integer;
{ IPC_ISPLAYING returns the status of playback.
If it returns 1, it is playing. if it returns 3, it is paused, if it returns 0, it is not playing.
If it returns something other than 1,3,or 0, something is screwed.
}
begin

GethWnd_WinAmp;
PlayBackStatus:= SendMessage(hwnd_winamp,WM_USER,0,IPC_ISPLAYING);
end;



Function GetOutPutTime( x : integer): Integer;
{ IPC_GETOUTPUTTIME returns the position in milliseconds of the
current song (lParam = 0), or the song length, in seconds (lParam = 1).
Returns -1 if not playing or error.}
begin

GethWnd_WinAmp;
if x = 0 then

GetOutPutTime := SendMessage(hwnd_winamp,WM_USER,x,IPC_GETOUTPUTTIME)
else

if x = 1 then

GetOutPutTime := SendMessage(hwnd_winamp,WM_USER,x,IPC_GETOUTPUTTIME);
end;


function JumpToTime(new_song_pos:integer):integer;
{ *ONLY AVAILABLE IN v1.60+*
IPC_JUMPTOTIME sets the position in milliseconds of the current song (approximately)
Returns -1 if not playing, 1 on eof, or 0 if successful }
begin

GethWnd_WinAmp;
JumpToTIme:=SendMessage(hwnd_winamp,WM_USER,new_song_pos,IPC_JUMPTOTIME);
end;


Function WritePlaylist : Integer;
{ *ONLY AVAILABLE IN v1.666+*
IPC_WRITEPLAYLIST writes the current playlist to <winampdir>//Winamp.pl }
begin

GethWnd_WinAmp;
WritePlayList := SendMessage(hwnd_winamp,WM_USER,0,IPC_WRITEPLAYLIST);
{ (cursong is the index of the current song in the playlist) }
end;



// THESE MIGHT CHANGE in the future :)
//Also, you can send standard WM_COMMAND messages to the Winamp window (for other controls), including
// Send using SendMessage(hwnd_winamp,WM_COMMAND,WINAMP_OPTIONS_EQ/*orwhatever*/,0);

Procedure ExecuteMessage(MessageToExecute:integer);
begin

GethWnd_WinAmp;
SendMessage(hwnd_winamp,WM_COMMAND,MessageToExecute,0);
end;


Procedure EQ;
// toggles the EQ window
begin

ExecuteMessage(WINAMP_OPTIONS_EQ);
end;


Procedure PlayList;
// toggles the playlist window
begin

ExecuteMessage(WINAMP_OPTIONS_PLEDIT);
end;


Procedure VolumeUp;
// turns the volume up a little
begin

ExecuteMessage(WINAMP_VOLUMEUP);
end;


Procedure VolumeDown;
// turns the volumedo
wn a little
begin

ExecuteMessage(WINAMP_VOLUMEDOWN);
end;


Procedure Forward5;
// fast forwards 5 seconds
begin

ExecuteMessage(WINAMP_FFWD5S);
end;


Procedure Rewind5;
// rewinds 5 seconds
begin

ExecuteMessage(WINAMP_REW5S);
end;



// the following are the five main control buttons, with optionally shift or control pressed
// (for the exact functions of each, just try it out)
Procedure Button1;
begin

ExecuteMessage(WINAMP_BUTTON1);
end;


Procedure Button2;
begin

ExecuteMessage(WINAMP_BUTTON2);
end;


Procedure Button3;
begin

ExecuteMessage(WINAMP_BUTTON3);
end;


Procedure Button4;
begin

ExecuteMessage(WINAMP_BUTTON4);
end;


Procedure Button5;
begin

ExecuteMessage(WINAMP_BUTTON5);
end;


Procedure Button1_Shift;
begin

ExecuteMessage(WINAMP_BUTTON1_SHIFT);
end;


Procedure Button2_Shift;
begin

ExecuteMessage(WINAMP_BUTTON2_SHIFT);
end;


Procedure Button3_Shift;
begin

ExecuteMessage(WINAMP_BUTTON3_SHIFT);
end;


Procedure Button4_Shift;
begin

ExecuteMessage(WINAMP_BUTTON4_SHIFT);
end;


Procedure Button5_Shift;
begin

ExecuteMessage(WINAMP_BUTTON5_SHIFT);
end;


Procedure Button1_CTRL;
begin

ExecuteMessage(WINAMP_BUTTON1_CTRL);
end;

Procedure Button2_CTRL;
begin

ExecuteMessage(WINAMP_BUTTON2_CTRL);
end;

Procedure Button3_CTRL;
begin

ExecuteMessage(WINAMP_BUTTON3_CTRL);
end;

Procedure Button4_CTRL;
begin

ExecuteMessage(WINAMP_BUTTON4_CTRL);
end;

Procedure Button5_CTRL;
begin

ExecuteMessage(WINAMP_BUTTON5_CTRL);
end;



Procedure PrevSong;
begin

ExecuteMessage(WINAMP_PREVSONG);
// always goes to the previous song (unlike button 1), 1.666+
end;


Procedure PopUpLoadFile;
// pops up the load file(s) box
begin

ExecuteMessage(WINAMP_FILE_PLAY);
end;


Procedure PopUpPreferences;
// pops up the preferences
begin

ExecuteMessage(WINAMP_OPTIONS_PREFS);
end;


Procedure AlwaysOnTop;
// toggles always on top
begin

ExecuteMessage(WINAMP_OPTIONS_AOT);
end;


Procedure PopUpAboutBox;
// pops up the about box :)
begin

ExecuteMessage(WINAMP_HELP_ABOUT);
end;



end.


 
>>namegm能得到播放歌曲的名称
it is very good
i will try it
 
碍碍 :D 好东西..
 
我也遇到同样的问题
怎么取到当前播放的mp3文件的路径+文件名
http://www.delphibbs.com/delphibbs/dispq.asp?lid=991248
 
在我的主页上面就有我自己做的一个控件,功能足以完成你要的操作,另外还准备了Winamp3
的支持。
http://shenloqi.51.net
http://shenloqi.51.net/html/zzkj.htm
 
哈哈,得到歌曲的文件路径和文件名,我做到了(在别人的指点下)!
var
filename: string;
szText: array[0..254] of char;
ch: PChar;
//得到歌词
Ch := Pointer(SendMessage(hwnd_winamp, WM_USER, SendMessage(hwnd_winamp, WM_USER, 0, 125), 211));
filename := copy(Strpas(ch), 1, length(Strpas(ch)) - 4) + '.lrc';
这个只能在插件中实现!
在外部程序不能得到!
我自己写的显示歌词(lrc格式)的插件
http://www.playicq.com/dispdoc.asp?id=699

 
后退
顶部