In short, it is not possible to directly call functions in another process. A process containing a function that you want to access (in this case, a Windows service) will have to expose it through some kind of IPC (interprocess communication). What type of IPC you choose will likely depend on how complex the connection is and whether the βclientβ is a .NET application.
If your needs are simple (for example, just setting a timer value) or if your client does not use .NET, using named pipes (or TCP if you need to access the service from another physical machine) is probably your best bet. Both named pipes and TCP give you Stream, for which you can write messages and read on the other end.
If you need to set up many different functions or send and receive complex data types, and if you use .NET at both ends, then it is probably best to use .NET Remoting or WCF..NET Remoting is simpler, but has more restrictions; WCF is very flexible, but has a steeper learning curve.
Aaron
source share