当前位置:   article > 正文

C# 获取QQ会话聊天信息

C# 获取QQ会话聊天信息

目录

利用UIAutomation获取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");
    }
}

  1. AutomationElement window = AutomationElement.FromHandle(get.WindowHwnd);
  2. AutomationElement QQMsgList = window.FindFirst(TreeScope.Descendants,
  3. new PropertyCondition(AutomationElement.NameProperty, "消息"));
  4. if (QQMsgList != null)
  5. {
  6. AutomationElementCollection ALLMsg = QQMsgList.FindAll(TreeScope.Descendants,
  7. new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.ListItem));
  8. foreach (AutomationElement item in ALLMsg)
  9. {
  10. rtxtInfo.AppendText(item.Current.Name + "\r\n");
  11. }
  12. }

目前遇到一个问题

获取的聊天信息不全,最近的多条聊天信息获取不到。

其他解决办法

1、截图OCR识别

2、不断复制,从剪切板中读取

本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/article/detail/45203
推荐阅读
相关标签
  

闽ICP备14008679号