Board index » delphi » Sending messages between windows

Sending messages between windows

Hi

Does anyone know the correct method of sending messages between windows
launched from a single application.  My current progams opens several
windows and I would like to be able to send messages to and from various
windows.

Any help greatly appreciated.

Warren Weber
warr...@austarnet.com.au

 

Re:Sending messages between windows


Quote
Warren Weber wrote in message ...
>Hi

>Does anyone know the correct method of sending messages between windows
>launched from a single application.  My current progams opens several
>windows and I would like to be able to send messages to and from various
>windows.

PostMessage?

Groetjes,
Maarten Wiltink

Re:Sending messages between windows


Hi Maaten

Thanks for your response.  I know of Postmessage but I am unsure as to how I
setup the destination window to recieve the message.  Anything further from
you would be much appreciated.

Quote
"Maarten Wiltink" <maar...@kittensandcats.net> wrote in message

news:a5ma8m$689$1@news1.xs4all.nl...
Quote
> Warren Weber wrote in message ...
> >Hi

> >Does anyone know the correct method of sending messages between windows
> >launched from a single application.  My current progams opens several
> >windows and I would like to be able to send messages to and from various
> >windows.

> PostMessage?

> Groetjes,
> Maarten Wiltink

Re:Sending messages between windows


Quote
"Warren Weber" <warre...@austarnet.com.au> wrote in message

news:a5mfoi$29kn$1@austar-news.austarnet.com.au...

Quote
> Hi Maaten

> Thanks for your response.  I know of Postmessage but I am unsure as to how
I
> setup the destination window to recieve the message.  Anything further
from
> you would be much appreciated.

first parameter of the PostMessage function is the handle of the destination
window.
If your destination window is, say Form2, then it would be Form2.Handle

Re:Sending messages between windows


Quote
Warren Weber wrote in message ...
>Hi Maaten

       ^
Tsk tsk.

Quote
>Thanks for your response.  I know of Postmessage but I am unsure as to how
I
>setup the destination window to recieve the message.  Anything further
from
>you would be much appreciated.

You override the window procedure to catch these messages, or
perhaps The Delphi Way would be to have a message handler method.

I wrote a simple bitmap viewer once that could close all its
siblings along with itself by broadcasting a message. (And to
my surprise, it used a message handler method rather than the
window procedure.) It's not pretty, but it's small and it works.
Would you like me to put it up somewhere?

Groetjes,
Maarten Wiltink

Re:Sending messages between windows


Im Artikel <a5jp6a$rd...@austar-news.austarnet.com.au>, "Warren Weber"
<warre...@austarnet.com.au> schreibt:

Quote
>Does anyone know the correct method of sending messages between windows
>launched from a single application.

Why do you want to send messages at all?

Messages are received by the WndProc, and then decoded and dispatched to the
according OnClick... handlers. I'd invoke the according form methods directly,
then there is no management overhead, and you can pass any required arguments
directly.

Sending standard Windows messages does not always work as expected, depending
on the kind of the message (event, notification...), which is not documented
anywhere.

You also may want to invoke Actions instead of sending messages.

DoDi

Re:Sending messages between windows


Quote
Maarten Wiltink wrote:
> ...
> I wrote a simple bitmap viewer once that could close all its
> siblings along with itself by broadcasting a message. (And to
> my surprise, it used a message handler method rather than the
> window procedure.) It's not pretty, but it's small and it works.
> Would you like me to put it up somewhere?

> Groetjes,
> Maarten Wiltink

Meetoo :-)

-> mailto:he...@uni-kassel.de

TIA-

Gottfried.

Re:Sending messages between windows


Quote
Gottfried Helms wrote in message <3C80B06C.2000...@hrz.uni-kassel.de>...
>Maarten Wiltink wrote:

>> ...
>> Would you like me to put it up somewhere?
>Meetoo :-)

http://huizen.dds.nl/~mfw/bmpview.zip

Groetjes,
Maarten Wiltink

Other Threads