Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Messages between VB6 and .NET

Posted on 2004-08-23
6
Medium Priority
?
325 Views
Last Modified: 2012-06-27
Is there a way to send messages between two applications.  Specifically, I will need to send messages from a C# application to a VB6 application.  (The VB6 app kind of functions like the parent of the C# app so they can be coordinated, so I need to be able to send messages from the C# app to the VB6 app to make things happen.)  Could it go the other way around?

Thanks in Advance,
Eric
0
Comment
Question by:egibson
  • 2
6 Comments
 
LVL 10

Accepted Solution

by:
eternal_21 earned 672 total points
ID: 11871835
There is nothing special about .NET applications that allows two of them to communicate to each other.  You could accomplish inter-application communication using DDE or .NET Remoting as a couple of examples.
0
 
LVL 22

Assisted Solution

by:cookre
cookre earned 664 total points
ID: 11872913
If you're up for a small challenge, you could use the Window's message pump by having your own WndProc in each program (attached to its own hidden window) to snag custom messages sent with PostMessage().  

Or, you could catch them with a local hook via SetWindowsHookEx().

Another common way is to create your own message queue with MSMQ:
http://aspdot.net/aspnet/msmq.aspx
0
 
LVL 7

Assisted Solution

by:NipNFriar_Tuck
NipNFriar_Tuck earned 664 total points
ID: 11892993
You can also use the attribute to make the .Net application COM capable, and allow eventing through the COM piece.

Check out for more discussion on this...

http://www.experts-exchange.com/Programming/Programming_Languages/C_Sharp/Q_21083444.html#11727127
0
 
LVL 22

Expert Comment

by:cookre
ID: 11893412
Someone just posted this easy way to get into the message pump in .NET - add a WndProc override:

protected override void WndProc(ref Message aMessage)
{
if (aMessage.Msg == your message)
   {
   //do something
   }
else
   {
   base.WndProc(ref aMessage);
   }

Just make up your own message codes, making sure they're above 0x0400.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question