Reputation: 8704
The question is related to this one, if i fail to do the described there.
Is it possible to run one program from another and call some functions from that run program after start? For example i might want to run little windows program from WCF service that will register on sip server and when i need to-ask it from the service to initiate calls to some numbers. So is it possible(without running some messaging server) and where to find information on how to implement that, if it is?
Thank you.
Upvotes: 0
Views: 108
Reputation: 3605
Here are some common ways to do this.
1) Command line arguments. Pass command-line parameters to an application that interprets those parameters, does some action, and exits
2) Inter-Process-Communication (IPC). This refers to any technique that allows 2 processes to communicate. There are lots of ways to do this, but using named pipes is a common one on Windows. See http://www.codeguru.com/csharp/csharp/cs_misc/sampleprograms/article.php/c7259/InterProcess-Communication-in-NET-Using-Named-Pipes-Part-1.htm for an example.
3) Run the called app as a network service that exposes endpoints containing the functions you want to call. The service remains running and accepts network requests which it then carries out, and responds back with results.
4) Console stdin and stdout redirecting (not sure if there is a better name for this). This is a variant on (1) where the (console-only) application remains running, but the calling app controls the stdin and stdout of the console app, and can thus interact with it. (Effectively, it can type stuff into the console and read whatever is written to the console).
Upvotes: 1