How to receive Messages from other application - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How to receive Messages from other application

dubidubi Posts: 121Member
Suppose if I send a message from one application,
how can the other application receive the message that I send.
I can use SendMessage API to send a message.
What should I use to receive a Message.

From Application1,I use

const WM_MYMESSAGE WM_APP+$200
SendMessage(appHandle,WM_MYMESSAGE,0,0);

What should be written in Application2 to receive this message.

Thanks for your replies.

Comments

  • zibadianzibadian Posts: 6,349Member
    : Suppose if I send a message from one application,
    : how can the other application receive the message that I send.
    : I can use SendMessage API to send a message.
    : What should I use to receive a Message.
    :
    : From Application1,I use
    :
    : const WM_MYMESSAGE WM_APP+$200
    : SendMessage(appHandle,WM_MYMESSAGE,0,0);
    :
    : What should be written in Application2 to receive this message.
    :
    : Thanks for your replies.
    :
    You need to write an OnMessage() event for the application.
  • dubidubi Posts: 121Member
    : : Suppose if I send a message from one application,
    : : how can the other application receive the message that I send.
    : : I can use SendMessage API to send a message.
    : : What should I use to receive a Message.
    : :
    : : From Application1,I use
    : :
    : : const WM_MYMESSAGE WM_APP+$200
    : : SendMessage(appHandle,WM_MYMESSAGE,0,0);
    : :
    : : What should be written in Application2 to receive this message.
    : :
    : : Thanks for your replies.
    : :
    : You need to write an OnMessage() event for the application.
    :

    Can you kindly give a sample piece of code,what to write
    in OnMessage() event.I haven't used Message Handling.
    Thanks Zibadian.

  • zibadianzibadian Posts: 6,349Member
    : : : Suppose if I send a message from one application,
    : : : how can the other application receive the message that I send.
    : : : I can use SendMessage API to send a message.
    : : : What should I use to receive a Message.
    : : :
    : : : From Application1,I use
    : : :
    : : : const WM_MYMESSAGE WM_APP+$200
    : : : SendMessage(appHandle,WM_MYMESSAGE,0,0);
    : : :
    : : : What should be written in Application2 to receive this message.
    : : :
    : : : Thanks for your replies.
    : : :
    : : You need to write an OnMessage() event for the application.
    : :
    :
    : Can you kindly give a sample piece of code,what to write
    : in OnMessage() event.I haven't used Message Handling.
    : Thanks Zibadian.
    :
    :
    [code]
    procedure TForm1.OnMessage(var Msg: TMsg; var Handled: Boolean);
    begin
    if Msg.Message = WM_MYMESSAGE then
    begin
    DoSomething(Msg.wParam, Msg.lParam);
    Handled := true;
    end;
    end;
    [/code]
Sign In or Register to comment.