我可以使用以下代码从Firefox窗口获取IAccessible对象:
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相关。任何帮助将不胜感激。
答案 0 :(得分:1)
显然,您无法使用IAccessible获取完整的HTML源代码。我找到了这个,但它在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中也不起作用:
HRESULT hr = AccessibleObjectFromWindow(hwnd, OBJID_CLIENT,
IID_IAccessible, (void**)&pAccessible);
if (SUCCEEDED(hr) && pAccessible != NULL) {
HRESULT hr = pAccessible->QueryInterface(
IID_ISimpleDOMNode, (void**)&pSimpleDOMNode);
}
我被困住了。 :(