ActiveX Control Fundamentals

本文探讨了ActiveX控件如何与Internet Explorer等容器集成。重点介绍了在控件激活过程中,如何通过IOleInPlaceSite接口通知容器获取IOleInPlaceObject接口,以及控件窗口如何被容器管理。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

From http://www.pluralsight.com/articlecontent/cpprep0199.htm:

Here we are, eight functions later, and we have an ActiveX control which can be embedded in any control container. This doesn't mean that you shouldn't reach for your nearest C++ library the next time you need to implement a control, but hopefully you have a better perspective on what that library is doing for you, and where to look when things don't behave as you expect.

It should be noted that the ActiveX support in Visual C++ (ATL and MFC) is much more than this simple implementation

From http://community.youkuaiyun.com/expert/Topicview2.asp?id=4868028

我一直搞不清楚,到底我创建的控件窗口在IE窗口中的位置是由我来管理还是由IE来管理,其实这根本不用我来操心。
  我一直以为是我只负责现实接口,容器主动来找接口,所以我一直觉得很奇怪,为什么IE没来找IOleInPlaceObject接口。现在发现其实不然,有的时候是要我来通知容器来拿接口的,IOleInPlaceObject就是这种情况。
  我在DoVerb收到OLEIVERB_INPLACEACTIVATE时,首先当然是创建我的控件窗口。然后,是关键一步,通过容器的IOleClientSite接口找到IOleInPlaceSite接口,然后调用IOleInPlaceSite->OnInPlaceActivate();这样IE就会来找IOleInPlaceObject接口了。在IOleInPlaceObject的GetWindow中我把我创建的控件窗口返回给容器,就这样,我的控件窗口就会归容器管辖,拖动滚动条时容器会根据情况移动我的控件窗口,根本不用我操心了。




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值