在.NET Windows窗体,我怎么能发送两个EXE文件或应用程序之间的数据? [英] In .NET Windows Forms, how can I send data between two EXEs or applications?

查看:143
本文介绍了在.NET Windows窗体,我怎么能发送两个EXE文件或应用程序之间的数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我提出的方案是基本的,二.NET可执行程序之间的互动。

The scenario that I bring forward is basically that of, interaction between two .NET executables.

我已经做了.NET Windows窗体运行在用户的计算机上,并做了一些具体的活动,因为它收集一些数据,在C#(应用程序A)的应用程序。 现在我有其他.NET Windows窗体的可执行文件(应用-B),也取得了在C#中,这也确实根据一些具体的活动提供了一定的输入或数据。

I have made a .NET Windows Forms application in C# (Application-A) that runs on a user's machine and does some specific activity, due to which it collects some data. Now I have another .NET Windows Forms executable (Application-B), also made in C#, which also does some specific activity based certain inputs or data provided.

现在我想在这里做的是,调用Application-B从应用程序A和一些数据传递给它。

Now what I want to do here is, call Application-B from the Application-A and pass the some data to it.

我如何做到这一点?

推荐答案

您可以使用多个选项。你有一些资源,下面的每个选项。

You can use several options. You have some resources for each option below.

  • 在.NET远程
  • WCF
  • 使用的通信文件
  • MSMQ

两个最后的选项是有效仅当过程是在同一台机器。

Two last options are valid only if the processes are in the same machine.

由于它们是两个独立的过程,我认为,要做到这一点,最简单的方法是使用 .NET远程这里你可以找到文档和示例如何做到这一点。

Since they are two separated processes I think that the easiest way to do this is using .NET Remoting. Here you can find documentation and examples about how to do it.

这是替代远程处理是 WCF (> = .NET 3.0 )。它执行更好比远程处理。

An alternative to Remoting is WCF (>= .NET 3.0). It performs better than remoting.

如果该过程将始终在同一台机器,如果你不想使用远程在本地主机上,你可以通过文件传达他们(的简单的解决方案通常工作得很好!的)

If the processes will be always in the same machine, if you don't want to use remoting on localhost you can communicate them through a file (simple solutions usually work fine!)

和其他更复杂的解决方案是使用消息队列(的 MSMQ )。 这里你C和了解如何使用它的一个例子。

And other more complex solution is communicate them using a Message Queue (MSMQ). Here you cand find out an example about how to use it.

这篇关于在.NET Windows窗体,我怎么能发送两个EXE文件或应用程序之间的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆