I converted this code from C# and i guess it doesn't work so people please test it i need it for my media player.
It doesn't work in WLM 2009??!!
Delphi-Quellcode:
type TCopyDataStruct = packed record
dwData: DWORD; //up to 32 bits of data to be passed to the receiving application
cbData: DWORD; //the size, in bytes, of the data pointed to by the lpData member
lpData: Pointer; //Points to data to be passed to the receiving application. This member can be nil.
end;
procedure tform3.SendData();
const
WM_COPYDATA = 74;
var
stringToSend : WideString;
copyDataStruct : TCopyDataStruct;
receiverHandle : THandle;
res : integer;
begin
stringToSend := 'fg';
copyDataStruct.dwData := 1351; //use it to identify the message contents
copyDataStruct.cbData := (1 + Length(stringToSend))*2;
copyDataStruct.lpData := PChar(stringToSend);
receiverHandle := FindWindowex(0,0,pchar('MsnMsgrUIManager'),nil);
if receiverHandle = 0 then
begin
ShowMessage('CopyData Receiver NOT found!');
Exit
end
else
SendMessage(receiverHandle,WM_COPYDATA, 0, Integer(@copyDataStruct));