473,387 Members | 1,483 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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

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
7 1572
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
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

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
"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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Anon Email | last post by:
Hi people, I'm learning about header files in C++. The following is code from Bartosz Milewski: // Code const int maxStack = 16; class IStack
3
by: masood.iqbal | last post by:
In this day and age, you never say no to any work that is thrown at you ---- so when I was offered this short-term contract to convert legacy C code to C++, I did not say no. Personally I believed...
7
by: Dev | last post by:
Hello, In the following class definition, the ZString destructor is invoked two times. This crashes the code. class ZString { public: ZString(char* p)
175
by: Ken Brady | last post by:
I'm on a team building some class libraries to be used by many other projects. Some members of our team insist that "All public methods should be virtual" just in case "anything needs to be...
8
by: Jef Driesen | last post by:
I'm working on an image segmentation algorithm. An essential part of the algorithm is a graph to keep track of the connectivity between regions. At the moment I have a working implementation, but...
52
by: lovecreatesbeauty | last post by:
Why the C standard committee doesn't provide a standard implementation including the C compiler and library when the language standard document is published? C works on the abstract model of low...
20
by: Luc Kumps | last post by:
(Sorry about the previous post, it got transmitted before it was complete) We try to separate implementation and interface defintions, but we run into a problem. I hope the guru's can solve this,...
11
by: magicman | last post by:
can anyone point me out to its implementation in C before I roll my own. thx
173
by: Ron Ford | last post by:
I'm looking for a freeware c99 compiler for windows. I had intended to use MS's Visual C++ Express and use its C capability. In the past with my MS products, I've simply needed to make .c the...
77
by: arnuld | last post by:
I have created my own implementation of strcpy library function. I would like to have comments for improvements: /* My version of "strcpy - a C Library Function */ #include <stdio.h>...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.