如何寻址另一个进程中由给定 IUnknown* 标识的 COM 对象?

发布于 2024-11-01 02:28:31 字数 356 浏览 4 评论 0原文

我编写了两个小型 C++ 应用程序,其中之一是嵌入一些 ActiveX 控件的 ActiveX 容器。此容器应用程序知道引用 ActiveX 控件的 IUnknown*

另一个应用程序是一个客户端,它将与前一个应用程序中的 ActiveX 控件进行交互。但是,我不知道如何获取客户端应用程序中的控件的句柄。由于独立的地址空间,简单地将 IUnknown* 的指针值从服务器传输到客户端当然是行不通的。

是否可以以某种方式“复制”某个 COM 对象的句柄,以便其他进程可以使用新创建的句柄?我想让 COM 为我完成 RPC 工作。否则,我需要在服务器应用程序中执行所有 COM 调用并亲自执行所有 RPC。 :-/

I wrote two small C++ applications, one of which is an ActiveX container embedding some ActiveX control. This container application knows the IUnknown* referencing the ActiveX control.

The other application is a client which shall interact with the ActiveX control in the former application. However, I don't know how to get a handle on the control in the client application. Simply transporting the pointer value of the IUnknown* from the server to the client won't work of courses due to independant address spaces.

Is it somehow possible to "duplicate" a handle to some COM object so that the newly created handle can be used by other processes? I'd like to have COM do the RPC work for me. Otherwise, I'd need to do all COM calls in the server application and do all the RPC myself. :-/

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

寒尘 2024-11-08 02:28:31

您可能想了解一下一般的 RPC 和 COM 代理

代理驻留在调用进程的地址空间中,并充当远程对象的代理。从调用对象的角度来看,代理就是对象。通常,代理的作用是封装接口参数,以调用其对象接口中的方法。代理将参数打包到消息缓冲区中,并将缓冲区传递到通道,通道处理进程之间的传输。代理被实现为聚合或复合对象。它包含一个系统提供的管理器部分(称为代理管理器)和一个或多个特定于接口的组件(称为接口代理)。接口代理的数量等于已暴露给该特定客户端的对象接口的数量。 对于遵守组件对象模型的客户端来说,代理看起来就是真实的对象。


You may want to look at RPC in general, and COM Proxies.

A proxy resides in the address space of the calling process and acts as a surrogate for the remote object. From the perspective of the calling object, the proxy is the object. Typically, the proxy's role is to package the interface parameters for calls to methods in its object interfaces. The proxy packages the parameters into a message buffer and passes the buffer onto the channel, which handles the transport between processes. The proxy is implemented as an aggregate, or composite, object. It contains a system-provided, manager piece called the proxy manager and one or more interface-specific components called interface proxies. The number of interface proxies equals the number of object interfaces that have been exposed to that particular client. To the client complying with the component object model, the proxy appears to be the real object.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文