How to get process handle of a local COM server?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-02 04:23:50

问题


I have an IUnknown pointer to a COM local (out of process) server in my Windows client application. Would like to get a handle to the window process that is running the local COM server.

Any way to do this via COM without adding a new interface to the server to request the process handle? (I can't easily change the server).

Why do I want to do this? Because I am trying to make sure the out-of-proc COM server gets shutdown IF my application crashes. I wanted to use windows job objects for this.


回答1:


I assume you mean an out-of-process server. No, COM is heavily invested in preventing you from retrieving this information. Important so it can host the COM object as it sees fit. Which enables things like surrogates, DCOM and the COM+ stuff.

You'll need the interface method.



来源:https://stackoverflow.com/questions/3586428/how-to-get-process-handle-of-a-local-com-server

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!