0

I have the processes list from Process.GetProcessesByName() and the objects list from UCOMIRunningObjectTable.EnumRunning().

How to match process to COM object hosted by that process?

For example I have 10 notepad.exe sessions and I want to find which session does not have any file opened and send a command to open a file. I use another app which exposes an API, this is just an example.

user247702
  • 23,641
  • 15
  • 110
  • 157
John Doe
  • 9
  • 1
  • That is *forbidden knowledge* in COM. If a process publishes objects in the ROT that it wants to be identifiable by the process ID then it will use a moniker that lets the client code select it. There's nothing that Notepad will do to make this easy, it is a simple program without an Automation interface. – Hans Passant Jul 29 '14 at 15:11
  • Thanks, but again, Notepad is given as an example. – John Doe Jul 29 '14 at 15:23
  • The COM object has to publish information by itself using regular COM interfaces, otherwise there is no official way. Example of various ugly hacks with Word: http://stackoverflow.com/questions/814936/get-pid-from-word-applicationclass – Simon Mourier Jul 29 '14 at 15:33

0 Answers0