View Single Post
Old 4th December 2005, 13:41   #1
cyby2005
Junior Member
 
Join Date: Dec 2005
Posts: 4
Help don't know what I make wrong! get titel and Interpret from winamp!

Hi, I have some problems to get the songtitel and interpret!

I use following code for it:

//programming with C++ Borland Builder 6
//Winamp Version 5.112
//wa sdk 504
Quote:
---- Header ----
//Die Structur aus der SDK deklariert!

typedef struct {
char *filename;
char *metadata;
char *ret;
int retlen;
} extendedFileInfoStruct;

//ein Structur Objekt erstellt!
extendedFileInfoStruct File;

---- Cpp Datei ----
//Winamp Handle
HANDLE hwnd_winamp;
//Winamp Handle Finden
hwnd_winamp = FindWindow("Winamp v1.x",NULL);
//Position ausfindig machen
int currentPos = SendMessage(hwnd_winamp,WM_USER,0,IPC_GETLISTPOS);
//Strucktur abrufen
SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)&File,IPC_GET_EXTENDED_FILE_INFO);
//File Name auslesen!!!
File.filename = (char*)SendMessage(hwnd_winamp, WM_WA_IPC, currentPos, IPC_GETPLAYLISTFILE);
But this Code Crasht Winamp...
*don't now why...*

So I search, and get this Code in the Winamp - Forum:

Quote:
#define IPC_GET_BASIC_FILE_INFO 291
//pass a pointer to the following struct in wParam
typedef struct {
char *filename;

int quickCheck; /*
set to 0 to always get,
1 for quick, 2 for default
(if 2, quickCheck will be set to 0 if
quick wasnot used) */

// filled in by winamp
int length;
char *title;
int titlelen;
} basicFileInfoStruct;

basicFileInfoStruct bfi;

bfi.quickCheck = 0;
bfi.filename = (char*)SendMessage(hwndWinamp, WM_WA_IPC, any_index, IPC_GETPLAYLISTFILE);
bfi.title = GlobalAlloc(GPTR, 1024);
SendMessage(hwndWinamp, WM_WA_IPC, (WPARAM)&bfi, IPC_GET_BASIC_FILE_INFO);
// Do whatever you want with bfi.title and bfi.length now...
GlobalFree((HGLOBAL)bfi.title);
but it crashed Winamp too.

*Don't know what I make wrong*

So I test it again:

Quote:

typedef struct {
char *filename;
char *title;
int length;
} enqueueFileWithMetaStruct;

enqueueFileWithMetaStruct File;

SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETVERSION);
SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)&File,IPC_PLAYFILE);
It crashed down again... -.-

I have search @ google and this forum! *long time* but nothing!

I don't know what i make wrong...

Can anyone Help me please ?

I only whant to get the titel & interprett!

MFG
Dennis
cyby2005 is offline   Reply With Quote