且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在其他应用程序中打开1个应用程序的形式?

更新时间:2023-10-16 15:26:58

你不可能像你描述的那样。 .DLL独立于所有其他进程加载到每个进程中。没有实例有其他存在的线索。



您必须实现某种形式的进程间通信(IPC),例如命名管道,然后应用程序可以彼此交谈并来回发送命令和数据。你必须在你的应用程序A中实现一个服务器,它接受你定义的任何命令并执行它们,比如弹出你的表单。



这不是一件容易的事。实施

How to open the form of 1 application in other application?

What I have tried:

Application A when runs, it'll call a DLL X

Application B when runs, it'll call a DLL Y at runtime to perform tasks → I would like display formLogin inside Application A, can do this?

Is that possible?

It's not possible like you described. The .DLL is loaded into each process independently of all others. No instance has a clue the others exist.

You'd have to implement some form of interprocess communication (IPC), such as named pipes, and the apps could then talk to each other and send commands and data back and forth. You'd have to implement a server in your Application A that accepts whatever commands you define and executes them, such as popping up your form.

This is NOT trivial to implement.