Click here to Skip to main content
15,888,113 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,
I am a beginer.I know c,c++ languages. I want to write code for message passing between two windows. suggest me some links and stuff required for writing the above application in visual c++.
Thanks in advance
Posted
Comments
Richard MacCutchan 18-May-12 4:47am    
What do you mean by this, are you trying to share information between multiple applications, or do you just want to send message alerts?
@bhinay 18-May-12 4:48am    
@richard MacCutchan
I want to first create two window apps . then i want pass messages between them(message alerts).
suggest me where i can study how to write the code for the required process.

I recomment you read about messaging[^] in MSDN for starters, Reading about SendMessage[^] and PostMessage[^] is also a good idea, learning the difference between the two. Window Procedures[^] is also a topic you might require.

I hope these can help you get started.
 
Share this answer
 
Comments
@bhinay 18-May-12 4:59am    
ya i had reffered them.. but i also want to study how write code for creating windows apps that contains message passing commands. is there any sample application/tutorials??
Code-o-mat 18-May-12 5:30am    
I'd say, google for the keywords: "hello world windows application C++", it should bring up some useful/interesting hits.
As already suggested, you should read the documentation of PostMessage (I wouldn't use SendMessage for communicating with another application). You should also have a look at RegisterWindowMessage[^] function documentation.
 
Share this answer
 
Comments
Aescleal 18-May-12 7:49am    
I wouldn't recommend using SendMessage either - might be worth adding to your answer why you don't. Personally I don't like it as it can cause deadlocks but I'd be interested in hearing if you have any other reasons.
CPallini 18-May-12 8:29am    
Yes, deadlock, that's it.
Other people have suggested using PostMessage to get data from one app to another. A handy message to post is WM_COPYDATA as it can carry an arbitrary lump of data from one process to another. This means you can design your own protocol between two apps in a fairly broad way.

If you're writing your code to run on Vista or later versions of windows you might also have to wrestle with ChangeWindowMessageFilterEx(). Vista filters out WM_COPYDATA messages between apps in a lot of cases and you have to explicitly say "Oi, I want to receive that message, bozo!"

Other ways you might like to try include memory mapped files (effectively shared memory between processes - again, it's a bit harder on Vista and later), named pipes or sockets (very portable if slower than other options).

Oh, and then there's RPC (remote procedure calls), COM (component object model), CORBA (like COM but with I can never remember what the acronym means - common object request broker rings a bell) and things like Java RMI (bit useless if you're not using Java).

Personally I'd start with sockets as they're portable and can be used between just about any two applications on the planet. They're also relatively easy to program compared to RPC and the like AND there's plenty of good textbooks around and example code on the net.

Cheers,

Ash
 
Share this answer
 
v2
 
Share this answer
 
Comments
Aescleal 18-May-12 7:52am    
I've been a bit fierce and hit you with a 1 for two reasons: The website you referenced wasn't in English and there was no warning it was a foreign language site. Second you could have introduced it for the questioner - just posting a URL is a bit like chucking a book at someone and they don't know which bits are relevant to them.

Add a bit of explanation and I'll happily vote your answer up - especially if you summarise what the website is about for us poor mono-linguists.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900