blue
blue

Reputation: 863

Program which stay in memory and I want to access data from other program code

I want to write a program in .NET (c#), this will run the memory (a formless/hidden form windows app). From another .net and VB6 application code I need to access the data stored in this program. How can I do this?

Any idea? I can make .net program as COM visible to make it accessible from VB code. But whenever I create an instance of this program to access from code I'll loose the data stored in this.

How do I overcome this?

Upvotes: 1

Views: 100

Answers (1)

Hans Passant
Hans Passant

Reputation: 942099

I can make .net program as COM visible to make it accessible from VB code

That doesn't do what you hope it does. Works fine at runtime, but you'll actually load the EXE as an in-process server. Just like a DLL. The CLR doesn't pay attention to the filename extension of a .NET assembly, only the display name. Everything seems to work just fine but of course you can't get the correct data.

Creating out-of-process servers in .NET is a pretty awkward affair. Only COM+ hosting is supported, you need to derive your visible classes from ServicedComponent. The how-to MSDN articles start here.

Consider using the standard .NET process interop support instead. Take your pick from sockets, named pipes or WCF.

Upvotes: 6

Related Questions