C# 获取QQ会话聊天信息

利用UIAutomation获取QQ会话聊天信息

            AutomationElement window = AutomationElement.FromHandle(get.WindowHwnd);

            AutomationElement QQMsgList = window.FindFirst(TreeScope.Descendants,
                new PropertyCondition(AutomationElement.NameProperty, "消息"));
            if (QQMsgList != null)
            {
                AutomationElementCollection ALLMsg = QQMsgList.FindAll(TreeScope.Descendants,
                    new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.ListItem));

                foreach (AutomationElement item in ALLMsg)
                {
                    rtxtInfo.AppendText(item.Current.Name + "\r\n");
                }
            }

 目前遇到一个问题,获取的聊天信息不全,最近的多条聊天信息获取不到。

猜你喜欢

转载自blog.csdn.net/lw112190/article/details/108681898