如何使用 IAccessible 在 Firefox 中访问文档的 HTML [英] How to access a document's HTML in Firefox using IAccessible

查看:27
本文介绍了如何使用 IAccessible 在 Firefox 中访问文档的 HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用以下代码从 Firefox 窗口获取 IAccessible 对象:

I can get an IAccessible object from a Firefox window using this code:

Guid guid = new Guid("{618736E0-3C3D-11CF-810C-00AA00389B71}");
object obj = null;
int ret = AccessibleObjectFromWindow(hWnd, 
    (uint) OBJID.WINDOW, ref guid, ref obj);
Accessibility.IAccessible acc = (Accessibility.IAccessible)obj;

但是,我不知道该从哪里开始.我需要从文档中获取完整的 HTML.我知道 IAccessible.get_accValue() 方法,但我不确定如何在 Firefox 中使用它.任何帮助将不胜感激.

However, I'm not sure where to go from here. I need to get the full HTML from the document. I know about the IAccessible.get_accValue() method, but I'm not really sure how to use it in relation to Firefox. Any help would be much appreciated.

推荐答案

显然您无法使用 IAccessible 获得完整的 HTML 源代码.我发现了这个,但它在 FF3.5 中不起作用:

Apparently you can't get the full HTML source using IAccessible. I found this but it doesn't work in FF3.5:

IServiceProvider *pServProv = NULL;
pAccessible->QueryInterface(IID_IServiceProvider, (void**)&pServProv);
ISimpleDOMNode *pSimpleDOMNode;
if (pServProv) {
  const GUID refguid = {0x0c539790, 0x12e4, 0x11cf, 0xb6, 0x61,
                        0x00, 0xaa, 0x00, 0x4c, 0xd6, 0xd8};
  HRESULT result = pServProv->QueryService(refguid, IID_ISimpleDOMNode,
                                           (void**)&pSimpleDOMNode);
  if (SUCCEEDED(hresult) && pSimpleDOMNode != NULL) {
    /* This is a Mozilla node! Use special ISimpleDOMNode methods described in
      ISimpleDOMNode.idl. */
  }
}

我也发现了这个,它在 FF3.5 中也不起作用:

I also found this, which doesn't work in FF3.5 either:

HRESULT hr = AccessibleObjectFromWindow(hwnd, OBJID_CLIENT,
      IID_IAccessible, (void**)&pAccessible);
if (SUCCEEDED(hr) && pAccessible != NULL) {
HRESULT hr = pAccessible->QueryInterface(
      IID_ISimpleDOMNode, (void**)&pSimpleDOMNode);
}

我被卡住了.:(

这篇关于如何使用 IAccessible 在 Firefox 中访问文档的 HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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