如何在另一个应用程序上打开新窗口..? [英] How to open new window on another application..?

查看:180
本文介绍了如何在另一个应用程序上打开新窗口..?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个Windows窗体应用程序,每个应用程序中有一个窗体。



现在我想在application1中从form1打开form1(我正在尝试使用按钮)点击...)



我尝试过:



创建2 Windows窗体应用程序

I have 2 Windows Forms Applications with one form in each application.

now I want to open form1 in application2 from form1 in application1(I am trying with button click...)

What I have tried:

Created 2 Windows Forms Application

推荐答案

不要。流程是孤立的,应该保持孤立。它可以在Windows消息的基础上实现,但这种方法过于Windows特定,与OS体系结构更重要的原则相矛盾的是由于其他原因通常是如此糟糕,所以我甚至不想讨论它们。



如果你真的需要不同进程之间的通信,你应该使用......好吧,通信,IPC,而不要触及任何远程进程的窗口。您将请求发送到另一个进程以抽象形式打开一个新窗口,另一个进程执行此操作。但即使这种方法看起来也值得怀疑。你没有提供任何理由。为什么不将应用程序合二为一?如果您需要这样的灵活性,仍然需要在一个流程中开发一些插件架构?为什么不使用多线程而不是两个进程?等等...



如果你回答所有这些问题,他们可能会发现你当前的架构是最糟糕的。好吧......可能。



现在,如果您仍然需要通信,它可以设计在许多不同的级别上,从套接字或命名管道到经典远程处理到WCF。请查看我过去的答案:

通信b / w LAN上的两个Windows应用程序。 [ ^ ],

我如何将byte []发送到其他电脑 [ ^ ]。



-SA
Don't. Processes are isolated and should remain isolated. It's possible to achieve on the base of Windows messages, but this approach is too Windows-specific, contradicts to more important principles of OS architecture is is generally so bad due to other reasons, so I don't even want to discuss them.

If you really need communication between different processes, you should use… well, communications, IPC, without touching any windows of a remote process. You send a request to another process to open a new window, in an abstract form, and the other process does it. But even this approach look quite questionable. You did not provide any justification. Why not have the applications united in one? Why not developing some plug-in architecture if you need such flexibility, still in one process? Why not using multithreading instead of two processes? And so on…

If you answer all this questions, they may reveal that your current architecture is the worst of all. Well… probably.

Now, if you still need the communications, it can be designed on many different levels, from sockets or named pipes to classic remoting to WCF. Please see my past answers:
Communication b/w two Windows applications on LAN.[^],
how i can send byte[] to other pc[^].

—SA


这篇关于如何在另一个应用程序上打开新窗口..?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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