seems to me that this code should return all the edit controls. However it returns nothing at all. Any idea where up?
For Each ctrl As AutomationElement In root.FindAll(TreeScope.Descendants, New PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Edit))
Inspect accesses the automation tree by way of the unmanaged UI Automation accessibility (IUIAutomationElement).
The code that you are using (AutomationElement) access the automation tree by way of the managed Microsoft Active Accessibility (MSAA) implementation.
It is this difference that is one potential reason for the difference in objects returned.
Can you try UISpy on your window and see what objects appear? Alternatively, change your code to use the IUIAutomationElement instead and it should match the objects that inspect returns.
Here's some great examples on how to utilize the unmanaged UIA API through C# via a COM-wrapper.
Microsoft is conducting an online survey to understand your opinion of the Msdn Web site. If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site.
Would you like to participate?