Click here to Skip to main content
15,890,043 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a sort of unusual project here. I am currently maintaining a system with roots all the way back to Windows 1.0. It started out as a suite of programs written in C that all communicated with each other through a shared DLL (in Win16). Then sometime in the 90s they decided to give it a better user interface, but nobody wanted to write one in C, so they tacked on some VB support programs. The VB programs are currently all VB6.

I was brought on board to fix a botched/incomplete 32 bit conversion. The conversion took the inter process communication from complex to byzantine. I have convinced them that a rewrite is their best path for the future.

However, the rewrite is going to be done in stages with the C programs getting replaced with a single modern EXE first (written in native C++). At least for the first few versions the new C++ program will still need to communicate with at least one VB program.

The VB communication now is done with DDE and the C side of it is huge and complex. I'm looking into better ways to do the communication and came across this article:

VC++ & VB Inter Process Communication Plus Introduction To VB Subclassing[^]

He discusses how to communicate between a VB6 program and a C++ DLL. Is it possible to do this between a C++ EXE and a VB6 EXE? I've done a fair bit of C and C++ programming (Windows as well as other OSs), but only a little VB program and this is the first time I've ever had to deal with a VB program communicating with another program. All the examples I can find are between VB and a DLL.

Thanks in advance,
Bill
Posted
Updated 15-Sep-10 1:45am
v2

There are a few ways to implement interprocess comms.

0) Registered messages that all of the applicable applications know about
1) Named pipes
2) TCP/IP sockets
3) Shared memory via a DLL (yes, you can still do this in 32-bit).

If it were me, I'd evaluate the possiblity of combining all of the applications into a single monolithic app, and avoid the interprocess comms stuff altogether.
 
Share this answer
 
In addition to what John said if you're feeling masochistic then something like RPC, COM or CORBA could be made to work as well.

Personally I'd go with a stream based interface (i.e. represent everything you have to communicate as a stream of bytes) and then use sockets, named pipes or shared memory (either via a shared section or a memory mapped file) to actually move the data around.

Cheers,

Ash
 
Share this answer
 
Eventually there will be one application (at least that's the plan), but the rewrite has to be done in stages and the VB code will not be incorporated into the new app in the first phase. So I need to leave some kind of inter process communication mechanism in place.

The current system is a mess as far as inter process communication goes. The guy who started the 32 bit conversion did put in a memory mapped file system for communication between the C programs only. That won't be necessary for the new app. Close to 1/3 of the existing code is just for inter process communication.

The customer would like to eliminate the DLLs if they can. The current system has about 8 DLLs and they have had problems with versions getting mixed and such. They aren't the most organized people when it comes to version control. (It's a hardware company and this is their only software product which works with a test instrument they sell.)

I believe the link to the example I posted uses strings to communicate back and forth. I'm far from an expert on VB, so I don't follow the code 100%. The demo app has buttons to execute each command and there is one that calls Activate which appears to load and start the DLL. I'm a little lost about how to do the same thing with an EXE that is already running.

It looks like Activate is a VB library function, but I can't find any reference to it in VB6 documentation.
 
Share this answer
 

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