|
|
#1 |
|
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. |
|
|
|
|
|
#2 |
|
Senior Member
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.
|
|
|
|
|
|
#3 |
|
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)); __________________________________________________________ |
|
|
|
|
|
#4 |
|
Senior Member
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
|
|
|
|
|
|
#5 |
|
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)); |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|