Solved

Messages between VB6 and .NET

Posted on 2004-08-23
6
298 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Run time Error 4 48
C# parent child form 5 28
VB.NET 2008 - SQL Timeout 9 24
VB.NET 2008 Winforms Signing 13 19
Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

777 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