在从 COleDocument 扩展的对象上实现 IConnectionPointContainer(而不是 COleControl)
有没有人有过使用 COM / MFC 尝试在从 COleDocument (而不是 COleControl )扩展的对象上实现 IConnectionPointContainer 的经验?有人可以提供任何提示或指导如何执行此操作吗?我需要为监听文档更改的对象实现通知,这些通知是作为文档实现的另一个接口的实现的一部分而进行的。
Has anybody had any experience with COM / MFC trying to implement IConnectionPointContainer on an object extending from COleDocument (instead of COleControl) ? Can somebody please provide any tips, or a pointer to a guide on how to do this ? I need to implement notifications for objects that listen to changes to the document, which are made as part of implementations of another interface which is implemented by the Document.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
MFC 连接宏并非特定于 COleControl,而是特定于 CCmdTarget。您可以使用 DECLARE_CONNECTION_MAP/BEGIN_CONNECTION_MAP 等 只要您类是从 CCmdTarget 派生的,在本例中是 COleDocument。
建议阅读:
TN038:MFC/OLE IUnknown 实现
Connpts.exe示例演示了如何实现连接点和连接点Visual C++ 中的下沉
MFC connection macros are not specific to COleControl but CCmdTarget. You can use DECLARE_CONNECTION_MAP/BEGIN_CONNECTION_MAP etc as long as your class is derived from CCmdTarget, and in this case, COleDocument is.
Suggested reading:
TN038: MFC/OLE IUnknown Implementation
Connpts.exe sample demonstrates how to implement connection points and connection point sinks in Visual C++