Seeking Advice for Inter-Application Communication (VB6 to C#)

J

Joseph Geretz

I need to communicate between two applications. The legacy application is in
VB6. New development is in C#. Here's the scenario:

The VB6 app will be pumping document files into a folder. We'll be writing a
new (C#) class for this new feature.

The C# Application (as distinct from the file pumper class just mentioned)
needs notification for each file pumped into the folder in order to process
the file.

(FileSystemWatcher is not going to do it for us. The C# Application needs
certain meta-information regarding each file, that the VB6 application is in
possession of. Yes, pairing a companion tag file together with each document
file might do the job, but is this really the best way to communicate
between two applications? By passing files around?)

So what is the best way to set up a 'conduit' beteen two applications? The
pattern I'm trying to achieve would have the source application initiate an
activity which would trigger an event raised in the target application to
notify the target application that the activity has occurred.

Thanks for any advice which you can offer!

- Joseph Geretz -
 
M

Marc Gravell

Well, from VB6 to C# you could:
* Enable COM for the relevant C# code and invoke that from the VB
* Use HttpListener to create a primitive web-server and communicate perhaps
via xml posts / response
* Use sockets (not so easy from VB6, but can be done maneagably via
3rd-party dlls)
* Use a backend polling store (db / file system / msmq)

If you want callback (I'm assuming the last line should have read "...notify
the source application...") then COM is probably your best bet (from VB6),
as IIRC simple events like EventHandler pose no real problems. Long term
something like Indigo might help (sorry... WCF; force of habit ;-p) , *if*
somebody produces a VB6/WCF plug-in. Personally I doubt that anyone will
bother too much, as it is often far too tempting to switch to VB.Net or C#
instead.

Oh, and "tut tut" to the cross-post.

Hope this helps,

Marc
 
L

Ludwig

I need to communicate between two applications. The legacy application is in
VB6. New development is in C#. Here's the scenario:

The VB6 app will be pumping document files into a folder. We'll be writing a
new (C#) class for this new feature.

The C# Application (as distinct from the file pumper class just mentioned)
needs notification for each file pumped into the folder in order to process
the file.

(FileSystemWatcher is not going to do it for us. The C# Application needs
certain meta-information regarding each file, that the VB6 application is in
possession of. Yes, pairing a companion tag file together with each document
file might do the job, but is this really the best way to communicate
between two applications? By passing files around?)

So what is the best way to set up a 'conduit' beteen two applications? The
pattern I'm trying to achieve would have the source application initiate an
activity which would trigger an event raised in the target application to
notify the target application that the activity has occurred.

Thanks for any advice which you can offer!

- Joseph Geretz -

have a look at
http://www.codeproject.com/dotnet/V...asp?df=100&forumid=42526&exp=0&select=1114812
 
C

chanmm

Interoperate between VB6, I assume it is a COM object, with C#. The new
features put it in C#.

chanmm
 
J

Joseph Geretz

Hi Marc,

Thanks for your reply.
If you want callback (I'm assuming the last line should have read
"...notify the source application...")

No, what I'd like is for the ability to have both applications share a
single instance of a class, so that a method called by the source
application, will cause an event to be raised to the target application.
This is not a new concept. Certainly, if I'd have the two applications
engineered as separate Forms in a single application this would be eminently
possible. What I'm looking for is a way to use this design pattern in an
inter-application scenario.
Oh, and "tut tut" to the cross-post.

vb.com - source application is VB6
csharp.com - target application is in C#
..interop - ties it all together

Why would you deny this discussion to any of these groups?

- Joseph Geretz -
 
M

Marc Gravell

Re source / target - I see what you mean; I read that line twice on Friday,
and thought I had it straight, but now I see what you mean. Lack of caffeine
(on me) last week I guess. Given your requirements, I maintain that COM
interop would be a viable (and simple) solution.

Also - it wasn't my intent to suggest that it was / wasn't relevant to those
groups... but cross-posting is just a major PITA for everyone except the
original poster. I can't see if somebody has already given the 100% perfect
solution (in another group) without going to a lot of hastle to look in
those groups. Seeing as there are more readers that original posters (=1),
then this means that either lots of people only see 1/10th of the replies,
or they also need to go out of their way. OK, some news clients will make
this easy. But some won't. Thats all. I'll shut up now ;-p

Best of luck,

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top