IntPtr k = FindWindow(null, "DCC");
AutomationElement window2 = AutomationElement.FromHandle(k);
PropertyCondition xEllist2 = new PropertyCondition(AutomationElement.NameProperty, "DCC");
AutomationElementCollection targetElement2 = window2.FindAll(TreeScope.Element, xEllist2);
AutomationElement AllEdit2 = window2.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.NameProperty, "消息"));
AutomationElementCollection ALLMsg2 = AllEdit2.FindAll(TreeScope.Descendants,
new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.ListItem));
List<string> message2 = new List<string>();
foreach (AutomationElement item in ALLMsg2)
{
string aaa = (item.Current.Name + "\r\n");
message2.Add(aaa);
}
DCC为qq窗口
获取的消息列表中只能到1