I would like to know if it's possible to get pid of a COM ActiveX Server from its instance like this :
myObject test = new myObject(); //Create an exe in tasklist
//get its PID
int pid = ...
//get the process
Process myProcess = Process.GetProcessById(pid);
//kill the process
proc.Kill();
I can't get the process with a foreach loop because I can have several process of this COM Server and I would like to kill the good instance when job is finishing.
Normally, the process is automatically destroyed when the job is done but in case it's not...
Thanks
EDIT : I add a getter in VB6 code that return the pid by using GetCurrentProcessID, and I get the process in C# with it and it works perfectly.