如何获取本地COM服务器的进程句柄? [英] How to get process handle of a local COM server?

查看:241
本文介绍了如何获取本地COM服务器的进程句柄?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个IUnknown指针指向我的Windows客户端应用程序中的COM本地(进程外)服务器。想要得到一个处理运行本地COM服务器的窗口进程。

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.

通过COM无需添加新的接口到服务器来请求进程句柄? (我不能轻易地更改服务器)。

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).

为什么要这样做?因为我试图确保out-of-proc COM服务器被关闭,如果我的应用程序崩溃。我想要使​​用 Windows作业对象

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.

推荐答案

我假设您的意思是一个进程外服务器。不,COM投入大量资金来防止您检索此信息。重要的是它可以托管COM对象,因为它认为合适。其中包括代理,DCOM和COM +的东西。

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.

你需要的接口方法。

这篇关于如何获取本地COM服务器的进程句柄?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆