Get the process ID of the COM server

I am doing automation using a combination of Windows messages sent directly to HWND and calls to a COM server opened by an automatic application.

If more than one instance is running, I need to determine the process ID of the COM server so that I can get to the same instance with a COM call as the one to which I am sending Windows messages.

I can list all running COM servers with a table of running objects and get scrolling for all of them, but the COM objects themselves do not provide methods that I can use to get a window handle, thread id, process id, or anything else like that.

Is there a way to find out, based on the nickname or the actual mandatory COM object of the nickname, what is the process ID of the COM server?

Thank!

+6
source share
2 answers

If you manage (write code for) both the server and the client, you can add a method to your COM interface that will return the process / thread identifier or something similar (for example, the host name of the server if it is deleted) to the end of the server . I'm second @Hans - if you don’t have access to the server implementation, you might be out of luck in design.

+6
source

I believe that the kimgr CoGetServerPID function will give you the process id of your COM server.

0
source

All Articles