我想知道是否有可能从实例中获取COM ActiveX Server的pid:
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();
我无法使用foreach循环来获取该进程,因为我可以拥有该COM Server的多个进程,并且我想在工作完成后杀死该好实例。
通常,该工作完成后会自动销毁,但万一不是...
谢谢
编辑:我在VB6代码中添加了一个吸气剂,该Getter通过使用GetCurrentProcessID返回pid,并且我用C#获取了该过程,并且它运行良好。