the simplest way i know is to use automation:
private void LoadApplicationNames()
{
AutomationElement rootElement = AutomationElement.RootElement;
var childs = AUW.Getchildrens(rootElement);
foreach (AutomationElement elemnt in childs)
{
string name = elemnt.Current.Name;
if (!string.IsNullOrWhiteSpace(name))
{
var listboxitem = new ListBoxItem();
listboxitem.Content = name;
listboxitem.Tag = elemnt.Current.AutomationId;
listBox1.Items.Add(listboxitem);
}
}
public AutomationElementCollection Getchildrens(AutomationElement parent)
{
Condition findCondition = new PropertyCondition(AutomationElement.IsControlElementProperty, true);
AutomationElementCollection childrens = parent.FindAll(TreeScope.Children, findCondition);
return childrens;
}
}