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、不断复制,从剪切板中读取

相关推荐
web小白成长日记1 天前
企业级 Vue3 + Element Plus 主题定制架构:从“能用”到“好用”的进阶之路
前端·架构
APIshop1 天前
Python 爬虫获取 item_get_web —— 淘宝商品 SKU、详情图、券后价全流程解析
前端·爬虫·python
风送雨1 天前
FastMCP 2.0 服务端开发教学文档(下)
服务器·前端·网络·人工智能·python·ai
XTTX1101 天前
Vue3+Cesium教程(36)--动态设置降雨效果
前端·javascript·vue.js
LYFlied1 天前
WebGPU与浏览器边缘智能:开启去中心化AI新纪元
前端·人工智能·大模型·去中心化·区块链
Setsuna_F_Seiei1 天前
2025 年度总结:人生重要阶段的一年
前端·程序员·年终总结
李建军1 天前
界止签章宗地号替换工具
c#
qq_425263321 天前
.net开发框架和语言
c#
model20051 天前
alibaba linux3 系统盘网站迁移数据盘
java·服务器·前端
武藤一雄1 天前
C# 关于多线程如何实现需要注意的问题(持续更新)
windows·后端·microsoft·c#·.net·.netcore·死锁