Hi I'm having problems with my SendMessage
.
It seams like the message never reaches my form (I'm using Winspector Spy to see which messages that are registered in my form), which is strange because I'm shure I'm sending to the correct Handle for the current form.
The SendMessage is within a dll but that should not have any thing to do with it.
//sStr is just an input where i type in the Handler address;
SendMessage(Integer(sStr),WM_COPYDATA, Integer(Handle),Integer(@copyDataStruct));
SendMessage returns 0 every time.
On the receiving end:
procedure WMCopyData(var Msg: TWMCopyData); message WM_CopyData;
procedure TMainForm.WMCopyData(var Msg: TWMCopyData);
var
s : string;
begin
s := PChar(Msg.CopyDataStruct.lpData);
showmessage(s);
//Send something back
msg.Result := 2006;
end;
I have also tried other messages like WM_CLOSE. Do any one know why this fails? I'm using Delphi 5.