- @sancarn: I've been doing various tests with Acc.
- Most of the time I haven't been able to get anything useful out of the accChild method.
- Typically these fail: oAcc.accChild(n) and Acc_Child(oAcc, n) (from Acc.ahk), as do attempts to call the vtable directly via DllCall.
- When I test on a child object, I get the error E_INVALIDARG := 0x80070057, and message 'The parameter is incorrect.'
- When I test on a child non-object I get S_FALSE := 1 as expected.
- However, I did find 2 examples in my script libraries where all 3 approaches did work, they were for Firefox and Chrome. I tested the Firefox code and it was still working, it retrieved text from Show All History (Ctrl+Shift+H).
- Virtually every time I've referred to child objects, it's been via the Acc_Children function in the Acc.ahk library, which uses oleacc\AccessibleChildren. That's been something that has seemed to always work.
- So perhaps when accChild fails, it's simply dependent on how something is implemented in the software you're using. So perhaps the message 'The parameter is incorrect.', is misleading/wrong, what we've sent is correct, and should work in theory, but for whatever reason the receiver isn't it handling it.
- When
oAcc.accChild(n) has worked, n was simply an integer. I did not need to use
oAcc.accChild(ComObject(type, n)).
- Link:
IAccessible::get_accChild (oleacc.h) - Win32 apps | Microsoft Docs
https://docs.microsoft.com/en-us/windows/win32/api/oleacc/nf-oleacc-iaccessible-get_accchild
- Example code to get a pointer from an Acc object:
Code: Select all
WinGet, hWnd, ID, A
oAcc := Acc_Get("Object", "4.4.4", 0, "ahk_id " hWnd) ;Notepad Find dialog 'Match case'
pAcc := ComObjValue(oAcc)
;pAcc := ComObject(oAcc) ;equivalent to line above
- List of methods for IAccessible:
Code: Select all
;INTERFACE - IAccessible
;source: oleacc.h
0 IUnknown::QueryInterface
1 IUnknown::AddRef
2 IUnknown::Release
3 IDispatch::GetTypeInfoCount
4 IDispatch::GetTypeInfo
5 IDispatch::GetIDsOfNames
6 IDispatch::Invoke
7 IAccessible::get_accParent
8 IAccessible::get_accChildCount
9 IAccessible::get_accChild
10 IAccessible::get_accName
11 IAccessible::get_accValue
12 IAccessible::get_accDescription
13 IAccessible::get_accRole
14 IAccessible::get_accState
15 IAccessible::get_accHelp
16 IAccessible::get_accHelpTopic
17 IAccessible::get_accKeyboardShortcut
18 IAccessible::get_accFocus
19 IAccessible::get_accSelection
20 IAccessible::get_accDefaultAction
21 IAccessible::accSelect
22 IAccessible::accLocation
23 IAccessible::accNavigate
24 IAccessible::accHitTest
25 IAccessible::accDoDefaultAction
26 IAccessible::put_accName
27 IAccessible::put_accValue