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

相关推荐
葬送的代码人生3 分钟前
React组件化哲学:如何优雅地"变秃也变强"
前端·javascript·react.js
用户52709648744904 分钟前
🚀 前端项目代码质量配置Prettier + Commitlint + Husky + Lint-staged
前端
xiaok5 分钟前
await返回之后的赋值给一个变量可以打印出数值,但是直接return回去之后,在另一个函数打印出来却是一个promise
前端
Bl_a_ck7 分钟前
【JS进阶】ES6 实现继承的方式
开发语言·前端·javascript
小马虎本人8 分钟前
如果接口返回的数据特别慢?要怎么办?难道就要在当前页面一直等吗
前端·react.js·aigc
蓝胖子的多啦A梦11 分钟前
npm : 无法加载文件 C:\Program Files\nodejs\npm.ps1,因为在此系统上禁止运行脚
前端·npm·node.js
LinCC714 分钟前
在Vite中构建项目出错-Top-level await is not available in the configured target environme
前端
用户8820932166715 分钟前
如何优雅拆分一个充斥十几种逻辑的 SDK 回调函数?
前端
Momoly0816 分钟前
vue3+el-table 利用插槽自定义数据样式
前端·javascript·vue.js
唯有选择17 分钟前
让你的应用界面好看的基石:Flutter主题Theme使用和扩展自定义字段
前端·flutter