从IE扩展中检测WebPage中的滚动 [英] Detect scrolling in WebPage from IE extension

查看:176
本文介绍了从IE扩展中检测WebPage中的滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个IE扩展(使用VS2008,C ++),该扩展需要对IE中的滚动条事件做出反应.我正在为此使用BHO,并且可以访问父窗口的IWebBrowser2元素,IHTMLDocument2元素和HWND.我不知道如何访问滚动条.我已经看到了可以访问滚动条的代码,但我却无法获取滚动条对象(或者它们是IE窗口的子窗口吗?).有什么想法吗?

I'm creating an IE extension (using VS2008, C++) that needs to react to scrollbar events in IE. I'm using BHO for that and I have access to IWebBrowser2 element, IHTMLDocument2 element and HWND of the parent window. I can't figure out how to access the scrollbars. I have seen codes that allows me to handle the scrollbar once I have access to them, but not how to get the scrollbar objects (or are they child window of the IE window?) themselves. Any ideas?

推荐答案

MSHTML呈现自己的滚动条,而不使用本机系统控件.这就是为什么您可以将CSS规则应用于它们的原因.

MSHTML renders its own scrollbars instead of using the native system controls. That's why you can apply CSS rules to them.

我会尝试的是:

  1. QueryInterface()IHTMLDocument2 IHTMLElement的对象.
  2. QueryInterface()用于 IConnectionPointContainer.
  3. 然后打电话 IConnectionPointContainer :: FindConnectionPoint(DIID_HTMLElementEvents2).
  4. 实施IDispatch :: Invoke()和 您应该获得 OnScroll 有人滚动时发生的事件 文档.
  5. 冲洗并重复子帧.
  1. QueryInterface() the IHTMLDocument2 object for IHTMLElement.
  2. QueryInterface() that for IConnectionPointContainer.
  3. Then call IConnectionPointContainer::FindConnectionPoint(DIID_HTMLElementEvents2).
  4. Implement IDispatch::Invoke() and you should get the OnScroll event when someone scrolls the document.
  5. Rinse and repeat for sub-frames.

这篇关于从IE扩展中检测WebPage中的滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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