By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,260 Members | 1,340 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,260 IT Pros & Developers. It's quick & easy.

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

P: n/a
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

Nov 3 '06 #1
Share this Question
Share on Google+
7 Replies


P: n/a
On 2 Nov 2006 21:47:20 -0800, "BruceWho" <Br**********@gmail.com>
wrote:
>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>
Nov 3 '06 #2

P: n/a
On Fri, 03 Nov 2006 08:54:00 +0100, Zara <me*****@dea.spamcon.org>
wrote:
>On 2 Nov 2006 21:47:20 -0800, "BruceWho" <Br**********@gmail.com>
wrote:
>>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>

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

Zara
Nov 3 '06 #3

P: n/a

BruceWho wrote:
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/

Nov 3 '06 #4

P: n/a
"BruceWho" <Br**********@gmail.comwrote in message
news:11**********************@f16g2000cwb.googlegr oups.com...
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 )
Nov 3 '06 #5

P: n/a
BruceWho wrote:
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
Nov 3 '06 #6

P: n/a
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

Nov 6 '06 #7

P: n/a
Did this class help you with solving your problem?

http://www.codeproject.com/docview/Broadcaster.asp

AliR.

"BruceWho" <Br**********@gmail.comwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
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

Nov 6 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.