![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
Управление Winamp
FXeS © (2005-07-18 12:22:00)Как можно узнать имя текущего проигрываемого файла и название трека ?
Poirot (2005-07-20 19:54:00) [1]А так вот ешшо лучше:))) гы:)
var
hWinamp: HWND;
hProcess: THandle;
dwProcessId, nBytesRead: DWORD;
curItem: Integer;
lpStr: PChar;
buffer: array[0..MAX_PATH - 1] of char;
const
IPC_GETPLAYLISTFILE = 211;
IPC_GETPLAYLISTTITLE = 212;
IPC_GETLISTPOS = 125;
WM_WA_IPC = WM_USER;
begin
hWinamp := FindWindow('Winamp v1.x', nil);
GetWindowThreadProcessId(hWinamp, @dwProcessId);
hProcess := OpenProcess( PROCESS_VM_OPERATION or PROCESS_VM_READ or PROCESS_VM_WRITE, FALSE, dwProcessId);
if hProcess = 0 then
begin
Exit;
end;
curItem := SendMessage(hWinamp, WM_WA_IPC, 0, IPC_GETLISTPOS);
lpStr := PChar(SendMessage(hWinamp, WM_WA_IPC, curItem, IPC_GETPLAYLISTFILE));
ReadProcessMemory(hProcess, lpStr, @buffer, MAX_PATH, nBytesRead);
(*
Теперь можешь делать с buffer всё что угодно - там имя текущего файла:)
Enjoy :)
*)
CloseHandle(hProcess);
end;
Eraser (2005-07-19 12:48:00) [2]+ на torry.net куча готовых решений.
Fox Mulder (2005-07-19 07:07:00) [3]Из внешней программы(не плагина) названия песни можно получить из заголовка WinAmp'овского окна.
uses Windows;
var
hwndWinamp: HWND;
title: array[0..200] of char;
begin
hwndWinamp: =FindWindow('Winamp v1.x', nil);
GetWindowText(hwndWinamp, @title, SizeOf(title));
title[strlen(title)-8]: =#0;
Label1.Caption:=title;
end;
FXeS (2005-07-18 18:39:00) [4]Я делаю так:
HWND h;
h = FindWindow("Winamp v1.x",0);
Form1->Caption = SendMessage(h, WM_WA_IPC, 0, 211);
Но возвращается ведь указатель. Каким образом получить строку?
Poirot (2005-07-18 16:03:00) [5]А мб просто ссылку?:)
Так много чего можно найти:)
http://www.winamp.com/nsdn/
Eraser (2005-07-18 12:34:00) [6]
#define WM_WA_IPC WM_USER
// messages are sent to the winamp window using:
//result = SendMessage(hwnd_winamp,WM_WA_IPC,command_data,command);
/* Messages available to send */
#define IPC_GETVERSION 0
/*
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.7x = 0x170x
Version 1.8x = 0x180x
Version 1.9x = 0x190x
Version 2.0x = 0x200x
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);
*/
#define IPC_PLAYFILE 100
/*
IPC_PLAYFILE is sent to the window for each char of a null terminated string of a file to ADD
to the playlist (it doesn't change the playing status). Note, if you pass a file with the extension
".m3u" it will be treated as a playlist.
for example:
char *file = "C:\\download\\booga.mp3";
int x;
for (x = 0; x