[Mwinapi-commits] SF.net SVN: mwinapi:[139] trunk/ManagedWinapi/Accessibility/ SystemAccessibleObje
Status: Beta
Brought to you by:
schierlm
From: <zi...@us...> - 2016-01-25 19:56:55
|
Revision: 139 http://sourceforge.net/p/mwinapi/code/139 Author: ziewer Date: 2016-01-25 19:56:53 +0000 (Mon, 25 Jan 2016) Log Message: ----------- Added "GetChild(int index)" to request a specific child instead of requesting all children Boosts performance when only a specific child is required but sao has many children (e.g. in Internet Explorer) Modified Paths: -------------- trunk/ManagedWinapi/Accessibility/SystemAccessibleObject.cs Modified: trunk/ManagedWinapi/Accessibility/SystemAccessibleObject.cs =================================================================== --- trunk/ManagedWinapi/Accessibility/SystemAccessibleObject.cs 2016-01-25 19:53:53 UTC (rev 138) +++ trunk/ManagedWinapi/Accessibility/SystemAccessibleObject.cs 2016-01-25 19:56:53 UTC (rev 139) @@ -538,6 +538,34 @@ } /// <summary> + /// Get specific child of accessible object. + /// </summary> + public SystemAccessibleObject GetChild(int index) + { + // ID-referenced objects cannot have children + if (childID != 0) return null; + + int cs = iacc.accChildCount, csReal; + object[] children = new object[1]; + + uint result = AccessibleChildren(iacc, index, 1, children, out csReal); + if (result != 0 && result != 1) + return null; + if (csReal == 1 && children[0] is int && (int)children[0] < 0) + return null; + List<SystemAccessibleObject> values = new List<SystemAccessibleObject>(); + if (children[0] != null) + { + try + { + return ObjectToSAO(children[0]); + } + catch (InvalidCastException) { } + } + return null; + } + + /// <summary> /// Highlight the accessible object with a red border. /// </summary> public void Highlight() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |