Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.