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

标签 c++ windows com activex ole

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

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

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

最佳答案

您可能想查看一般的 RPC 和 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.

关于c++ - 如何寻址由另一个进程的给定 IUnknown* 标识的 COM 对象?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5662035/

相关文章:

delphi - TChromium 中的默认界面缺失

c# - 在 C# 中使用 VB6 OCX 生成的事件

c++ - vector 的点积,矩阵求逆,boost 中的特征值计算

C++ 2 重载有类似的转换

C++ 转换为基数和 "overwriting"vptr 问题

windows - 当提供的缓冲区太小时返回哪个 HRESULT?

c++ - _IDTExtensibility2,要将什么 DLL 导入到 ATL 项目中?

c++ - 如何检测显式转换运算符,is_constructible 应该工作吗?

c++ - 如何使用 MSTest 为 C++ 测试设置数据驱动测试?

c - WM_MOUSEMOVE 位置问题