I am sending message WM_COPYDATA to my application which has a lot of forms, but I cannot receive it. Simple Application with one form works fine.
I have this code in main form. No message received
private
procedure ReceiveMessage(var Msg: TWMCopyData); message WM_COPYDATA;
...
procedure TForm1.ReceiveMessage;
begin
ShowMessage(PAnsiChar(Msg.CopyDataStruct.lpData));
end;
I checked Application and main form handles. So handles looks like:
Form1.Handle (main form) = 3348672
FindWindow result = Application.Handle = 7148290
FindWindowEx(Application.Handle,0,nil,nil) = 0
I read here(Delphi: What is Application.Handle?) in Don's answer that messages which were sent to Application handle are redirected to main form, but in my situation it doesnt happen. How can I receive messages? Why messages are not redirected to main form?
Testing under Delphi XE8, Windows 10