ALERT = 0xFFFFFFF6,
SOUND = 0xFFFFFFF5,
}
[DllImport("user32.dll")]
public static extern int FindWindowEx(int hwndParent, int hwndChildAfter,
string lpszClass, string lpszWindow);
public static void msaa(IntPtr hwnd2)
{
object ōbj = new object();
Guid guid = new Guid("{618736E0-3C3D-11CF-810C-00AA00389B71}");
AccessibleObjectFromWindow(hwnd2, (uint)OBJID.WINDOW, ref guid, ref obj);
IAccessible accessible = obj as IAccessible;
accessible = accessible as IAccessible;
Object[] childs = new Object[accessible.accChildCount];
int ōbtained = 0;
try
{
AccessibleChildren(accessible, 0, accessible.accChildCount, childs, ref obtained);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Console.WriteLine(accessible.accChildCount);
Console.WriteLine(obtained.ToString());
for (int i = 0; i < obtained; i++)
{
IAccessible child = childs[i] as IAccessible;
Console.WriteLine(child.get_accName(0));
Object[] accchilds = new Object[child.accChildCount];
int result = 0;
AccessibleChildren(child, 0, child.accChildCount , accchilds, ref result);
for (int j = 0; j < result; j++)
{
IAccessible jchild = accchilds[j] as IAccessible;
Console.WriteLine(jchild.get_accName(0));
}
}
}
}
}
延伸阅读
文章来源于领测软件测试网 https://www.ltesting.net/