Any implementation for one-many message dispatching mechanism in C++?

B

BruceWho

Hi, all

Is there any mature library which implements a global message
dispatching mechanism? I'm playing with wxpython in my spare time, and
I like the pubsub or pyDispatch module very much. Any object can
register a callable object to an event, and when this event happens the
callable object(or maybe more than one objects) is called.

I donnot like MFC's SendMessage() and PostMessage() because we must get
a hWnd at the same time. Maybe more than one object need to be called.
I cannot find such implementation in MFC.

I guess maybe someone has already made such a library, so could anybody
figure me out?

Bruce
 
Z

Zara

Hi, all

Is there any mature library which implements a global message
dispatching mechanism? I'm playing with wxpython in my spare time, and
I like the pubsub or pyDispatch module very much. Any object can
register a callable object to an event, and when this event happens the
callable object(or maybe more than one objects) is called.

I donnot like MFC's SendMessage() and PostMessage() because we must get
a hWnd at the same time. Maybe more than one object need to be called.
I cannot find such implementation in MFC.

I guess maybe someone has already made such a library, so could anybody
figure me out?

This is off-topic in this list. You should look in some Windows
specific list.

<OT>
Do you know about HWND_BROADCAST?
Take a look at SendMessage documention in msdn.microsoft.com
</OT>
 
Z

Zara

This is off-topic in this list. You should look in some Windows
specific list.

<OT>
Do you know about HWND_BROADCAST?
Take a look at SendMessage documention in msdn.microsoft.com
</OT>


Sorry for the OT flag on any other list than comp.lang.c++, I didn´t
realise it was multiposted

Zara
 
S

Salt_Peter

BruceWho said:
Hi, all

Is there any mature library which implements a global message
dispatching mechanism? I'm playing with wxpython in my spare time, and
I like the pubsub or pyDispatch module very much. Any object can
register a callable object to an event, and when this event happens the
callable object(or maybe more than one objects) is called.

I donnot like MFC's SendMessage() and PostMessage() because we must get
a hWnd at the same time. Maybe more than one object need to be called.
I cannot find such implementation in MFC.

I guess maybe someone has already made such a library, so could anybody
figure me out?

Bruce

We don't do MFC here.

Check out boost::signals
http://www.boost.org/doc/html/signals.html
or libsigc
http://libsigc.sourceforge.net/
 
M

Michael K. O'Neill

BruceWho said:
Hi, all

Is there any mature library which implements a global message
dispatching mechanism? I'm playing with wxpython in my spare time, and
I like the pubsub or pyDispatch module very much. Any object can
register a callable object to an event, and when this event happens the
callable object(or maybe more than one objects) is called.

I donnot like MFC's SendMessage() and PostMessage() because we must get
a hWnd at the same time. Maybe more than one object need to be called.
I cannot find such implementation in MFC.

I guess maybe someone has already made such a library, so could anybody
figure me out?

Bruce

This sounds to me like a standard observer pattern (see
http://en.wikipedia.org/wiki/Observer_pattern ) or an event listener pattern
(see http://en.wikipedia.org/wiki/Event_listener )
 
L

Larry Smith

BruceWho said:
Hi, all

Is there any mature library which implements a global message
dispatching mechanism? I'm playing with wxpython in my spare time, and
I like the pubsub or pyDispatch module very much. Any object can
register a callable object to an event, and when this event happens the
callable object(or maybe more than one objects) is called.

I donnot like MFC's SendMessage() and PostMessage() because we must get
a hWnd at the same time. Maybe more than one object need to be called.
I cannot find such implementation in MFC.

I guess maybe someone has already made such a library, so could anybody
figure me out?

Bruce

DBUS perhaps?

The Windows port can be found here:
http://sourceforge.net/projects/windbus

The main page and docs can be found here:
http://www.freedesktop.org/wiki/Software/dbus
 
B

BruceWho

Hi, all

I'm sorry to reply so late.

HWND_BROADCAST is not exactly what I want, I want this message to be
sent to every registered functions, only top level windows can get the
HWND_BROADCAST message.

DBUS is not either. It seems that it is used in two different
applications while the mechanism which I need is only used in one
application.

Yes, what I need is exactly an observer pattern. And boost::signals &
libsigc are what I want, I'll look into them. Thanks for all your help!


Bruce
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top