Solved

Messages between VB6 and .NET

Posted on 2004-08-23
6
280 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 168 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 166 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 166 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

760 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now