Go Back   Winamp Forums > Developer Center > Winamp Development

Reply
Thread Tools Search this Thread Display Modes
Old 9th June 2002, 11:30   #1
Trumml
Junior Member
 
Join Date: Jun 2002
Posts: 2
Load title

Dear guys,
i'm currently developing a delphi-application to control two winamp instances. First i open two winamp instances and save the handles of those two.
Now it's no problem to control the winamps with the handle and the SendMassage() method but i can't load a song into winamp!

!!! The C code is !!!
__________________________________________________________________
#define IPC_PLAYFILE 100
COPYDATASTRUCT cds;
cds.dwData = IPC_PLAYFILE;
cds.lpData = (void *) "file.mp3";
cds.cbData = strlen((char *) cds.lpData)+1; // include space for null char
SendMessage(hwnd_winamp,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds);
__________________________________________________________________

!!! but the following delphi code doesn't work !!!
__________________________________________________________________
cds: TCopyDataStruct;
cds.dwData := 100;
cds.cbData := Length(FileName)+1;
cds.lpData := StrAlloc(cds.cbData);
SendMessage(winamp_handle, WM_COPYDATA, WPARAM(winamp_handle),LPARAM(@cds));
__________________________________________________________________

what's wrong with that delphi code snippet?

greetings,
martin from austria.
[and NO, in Austria we do not have kangaroos (-;]



Last edited by Trumml; 9th June 2002 at 11:53.
Trumml is offline   Reply With Quote
Old 9th June 2002, 14:27   #2
Gourou
Senior Member
 
Gourou's Avatar
 
Join Date: Feb 2002
Location: The backside of the universe on the trailing edge of eternity
Posts: 238
maybe you have the same prob as I did and have to use the CopyDataSendMessage API instead of just plain SendMessage, other than that, I dont see a problem, I dont know delphi too well, but are you passing the pointer of the string to the filename and not just the string itself? that's the only other problem I had.
Gourou is offline   Reply With Quote
Old 9th June 2002, 19:42   #3
Trumml
Junior Member
 
Join Date: Jun 2002
Posts: 2
...

I think my code is correct now, but it still doesn't work. Is it possible, that this method only works within a Winamp plugin?

__________________________________________________________
cds.dwData := 100;
cds.lpData := pchar(FileName);
cds.cbData := length(FileName)+1;
SendMessage (winamp_handle,WM_COPYDATA,longint(Handle),longint(@cds));
__________________________________________________________
Trumml is offline   Reply With Quote
Old 9th June 2002, 20:54   #4
Gourou
Senior Member
 
Gourou's Avatar
 
Join Date: Feb 2002
Location: The backside of the universe on the trailing edge of eternity
Posts: 238
no, because the vb code works external, you need some delphi programmer style help, good luck on this
Gourou is offline   Reply With Quote
Old 14th June 2002, 16:23   #5
shrom
Junior Member
 
Join Date: Jun 2002
Posts: 6
Try this, it works for me:

cds.dwData := 100;
cds.lpData := PChar(MusicFile);
cds.cbData := strlen(cds.lpData) + 1;
SendMessage(Handle, WM_COPYDATA, 0, LongInt(@cds));
shrom is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > Winamp Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump