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");

}

}

复制代码
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、截图OCR识别

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

相关推荐
问心无愧05132 小时前
ctf show web入门160 161
前端·笔记
李小白662 小时前
第四天-WEB服务器基本原理,IIS服务
运维·服务器·前端
humcomm3 小时前
AI编程时代新前端职位
前端·ai编程
好家伙VCC3 小时前
Web Components主题热切换方案揭秘
java·前端
甲维斯4 小时前
Kimi版超级玛丽效果“惊人”,配额不足5厘米!
前端·人工智能
hboot4 小时前
AI工程师第一课 - Python
前端·后端·python
凉菜凉凉4 小时前
AI时代,被抛弃的前端
前端·ai
console.log('npc')4 小时前
AI前端工程与生成式UI学习路线
前端·人工智能·ui
梦曦i4 小时前
uni-router v1.1.1发布:守卫超时保护+路由监听
前端·uni-app
qq_2518364575 小时前
基于java Web网络订餐系统设计与实现 源码文档
java·开发语言·前端