My VB6 macro (COM) has successfully called into my managed code, COM-visible stub. My COM-visible stub has successfully started my WPF process (.exe). "Life is good". Now, I need to access a method within my WPF process and pass in some parameters.
我的VB6宏(COM)已成功调用我的托管代码,COM-visible stub。我的COM可见存根已成功启动我的WPF进程(.exe)。 “生活很好”。现在,我需要在我的WPF进程中访问一个方法并传入一些参数。
I know that I can start my WPF process with parameters, but my VB6 macro will occasionally call my COM-visible stub with new parameters and I need to pass this into my running process.
我知道我可以用参数启动我的WPF进程,但是我的VB6宏偶尔会用新参数调用我的COM可见存根,我需要将它传递给我的运行进程。
I've thought of stopping/re-starting my process with new parameters, but that seems somewhat extreme.
我曾想过用新参数停止/重新启动我的过程,但这看起来有些极端。
How do I access a method withing my running process?
如何使用正在运行的进程访问方法?
2 个解决方案
#1
1
From the operating system's point of view, a process doesn't have methods. So the only way to communicate between processes is to use some kind of inter-process communication. In C#, you could using a Remoting IPC channel or WCF. Take a look here.
从操作系统的角度来看,一个进程没有方法。因此,进程之间进行通信的唯一方法是使用某种进程间通信。在C#中,您可以使用Remoting IPC通道或WCF。看看这里。
#2
1
You can host a WCF service inside your WFP application. You can then have your COM code call the service.
您可以在WFP应用程序中托管WCF服务。然后,您可以让您的COM代码调用该服务。
#1
1
From the operating system's point of view, a process doesn't have methods. So the only way to communicate between processes is to use some kind of inter-process communication. In C#, you could using a Remoting IPC channel or WCF. Take a look here.
从操作系统的角度来看,一个进程没有方法。因此,进程之间进行通信的唯一方法是使用某种进程间通信。在C#中,您可以使用Remoting IPC通道或WCF。看看这里。
#2
1
You can host a WCF service inside your WFP application. You can then have your COM code call the service.
您可以在WFP应用程序中托管WCF服务。然后,您可以让您的COM代码调用该服务。