Ok so for those who do not understand the code please at the moment don't ask about it. I am stumped on the following:
js code:
if (Messenger.MyStatus === STATUS_UNKNOWN) {
Debug.DebuggingWindowVisible = true;
var hWnd = Interop.Call('user32', 'FindWindowExW', Messenger.ContactListWndHandle, 0, 'Main Window Class', '');
hWnd = Interop.Call('user32', 'FindWindowExW', hWnd, 0, 'DirectUIHWND', '');
var IID_IAccessible = Interop.Allocate(16);
with (IID_IAccessible) {
WriteDWORD(0, 0x618736E0);
WriteWORD(4, 0x3C3D);
WriteWORD(6, 0x11CF);
SetAt(8, 0x81);
SetAt(9, 0xc);
SetAt(10, 0x0);
SetAt(11, 0xaa);
SetAt(12, 0x0);
SetAt(13, 0x38);
SetAt(14, 0x9b);
SetAt(15, 0x71);
}
var pAccessibleData = Interop.Allocate(4);
if(Interop.Call('oleacc', 'AccessibleObjectFromWindow', hWnd, 0xFFFFFFFC /* OBJID_CLIENT */, IID_IAccessible, pAccessibleData) === 0) {
var iAccessible = pAccessibleData.ReadInterfacePtr(0);
if(iAccessible) {
var iAccessibleChildren = Interop.Allocate(16*iAccessible.accChildCount);
var iAccessibleChildrenFound = Interop.Allocate(4);
if (Interop.Call('oleacc', 'AccessibleChildren', iAccessible, 0, iAccessible.accChildCount, iAccessibleChildren, iAccessibleChildrenFound) === 0){
for (var i=0; i<iAccessibleChildrenFound.ReadDWORD(0); ++i) {
if (iAccessibleChildren.ReadDWORD(i*16) === 0x9 /* VT_DISPATCH */) {
var iAccessibleChild = iAccessibleChildren.ReadInterfacePtr(i*16+8);
if (iAccessibleChild) {
try{
>>> Debug.Trace(iAccessible.accName(iAccessibleChild));<<<
}catch(e){
Debug.Trace('epic fail #5');
}
} else {
Debug.Trace('epic fail #4');
}
}
else {
Debug.Trace('epic ail #3');
}
}
}
else {
Debug.Trace('epic ail #2');
}
}
else {
Debug.Trace('epic ail #1');
}
}
}
Currently I have no problem getting the initial iAccessible interface. The problem lies with being able to get even the Names of the child objects.
I have tried many different variations for the highlighted code but to no avail. Note the code only works on the contact list window that is not signed in yet.
I have tried
- iAccessibleChild.accName()
- Copying the pointer to a new databloc and using ReadInterfacePtr
- the list goes on; but I forget all that I have tried.