How to access variables from a console application in a Windows Forms based application?
One solution is to use EMS and communicate back the variables. Any 开发者_开发问答other possible way?
You can try to implement this by using:
- IPC (Inter Process Communication via Named pipes)
- Shared memory (Memory mapped files)
- Socket (TCP/IP)
Example of using WCF: Many to One Local IPC using WCF and NetNamedPipeBindin
Other example: A C# Framework for Interprocess Synchronization and Communication
Everything depends on what version of .Net Framework you use. If you use .net 3.0. and above then you can take a look into WCF. If not then you are on your own and you can google on keywords P/Invoke (CreateFileMapping, MapViewOfFile, CreatePipe...)
You named it. Remoting is your friend. Unless you are using .NET 3+, in which case WCF should be preferred.
精彩评论