Hi, and thanks for the tip.
Further to this, I am looking to solve the following problem and I'll be thankful to you, if you can assist.
A service written in C exposing some normal and call back functions, running under Windows. For this Service, I have its TLB, dll and Lib files. I need to know how can I hook to the service from C# and call its function as well as subscribe to the delegates?
What I have done is successfully DllImported and called the function from the imported dll; however, I am unable to directly call the Running Instance.
I actually didn't get the problem. You are saying you can call the imported functions from the dll (which is your service) - then what do you mean by directly calling the running instance?? Do you mean, you might be running more than one servinces and you want to invoke a function of a specific service?
Thanks for the reply.
Lemme explain a bit further:
I have a running application (written in C) exposing some normal and call back functions. What I have managed was able to refer the LIB/TLB to my C# application and call the functions, using DllImport and this is done using the application executable from the same folder of my C# application.
As the application is already running under Windows, I think I need some IPC kind of thing in order to directly communicate to the Running Instance of the application.
One solution can be, which might sound a little complicated (atleast to me), create a COM enabled C# project and through COM maintain the IPC.
It is possible to create and communicate through COM in C# applications. So from your service app, you can CoCreate the C# COM and communicate directly with the service.
Another easy solution I can think of is, use a Managed C++ project which should be able to communicate with your service application directly. Instead of the application executable, put the managed C++ dll (which uses IPC mechanizms to directly communicate to the running instance of the application) in the same folder of your C# application and call some exported managed C++ routines from your C# application (through dllimport in C#) which in turn does the Interprocess Communication kind of stuff.