.NET Interop: Find All instances of of a running COM object with C#
问题 Background I am automating some Office application (Word and PowerPoint) via command-line tool. One thing my tool needs to do is locate all the running instances of Word. I know how to get a reference to one of the instances... Object running_obj = null; { running_obj = System.Runtime.InteropServices.Marshal.GetActiveObject(progid); } catch (System.Exception) { //failed to find the object; } if (running_obj!=null) { var running_obj_type = System.Type.GetTypeFromProgID(progid); Microsoft