Try it with the handle of the dll.
cds.dwData:=SendMessage(FindBsplayer,WM_COPYDATA,A pplication.Handle,lParam(@cds));
If you get an Error with 'Application' add the Forms and Windows units to the DLL unit. I don't remember if a dll project adds this two units for you. (the Application object is declared in the Forms unit, while the THandle data type is stored in the Windows unit)
Another way would be that you use the handle of the application that calls your dll:
Code:
procedure dllFunction(AHandle: THandle);
var
OldHandle: THandle;
begin
// Store the DLLs handle
OldHandle := Application.Handle;
// Assign the handle of the main application to the DLL's handle
Application.Handle := AHandle;
// now do what you want
SendMessage(F.....
// Restore the DLL's old handle, otherwise when freeing the DLL
// the application will close at the same time.
Application.Handle := OldHandle;
end;
In the calling application would you call your function like this:
Code:
begin
...
dllFunction(Application.Handle);
...
end;
I realy haven't been using Delphi for some time now so sorry if i told you just garbage.