Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I've started a process, how do I call a method in that process

Tags:

c#

wpf

c#-4.0

com

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.

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.

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?

like image 527
JimBoone Avatar asked Nov 05 '22 09:11

JimBoone


2 Answers

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.

like image 74
Daniel Gabriel Avatar answered Nov 09 '22 12:11

Daniel Gabriel


You can host a WCF service inside your WFP application. You can then have your COM code call the service.

like image 23
John Saunders Avatar answered Nov 09 '22 11:11

John Saunders