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

相关推荐
excel11 小时前
Nuxt + Twin CSS 中宽度超过屏幕时底部出现空白的原因与解决方案
前端·javascript
计算机魔术师12 小时前
美国司法部正式站队 OpenAI,AI 训练的版权账要这么算了
前端
IT_陈寒12 小时前
React Hooks闭包陷阱差点让我加班到凌晨
前端·人工智能·后端
风骏时光牛马12 小时前
疑难Bug根因定位与问题复盘分析
前端
创新技术阁13 小时前
FastapiAdmin 系统日志体系与核心配置参数详解
前端·后端·fastapi
掘金酱13 小时前
【社区公告】签到与矿石奖励解耦说明
前端
公子小六13 小时前
基于.NET的Windows窗体编程之WinForms滑块与上下控件
windows·microsoft·c#·.net·winforms
promiseThen13 小时前
LWC Workflow:用 7 个 Cursor Skill 搭一条 AI 协作开发流水线
前端·ai编程
一个游离的指针13 小时前
函数管道:消除深度嵌套调用
前端·javascript
浅诺14 小时前
Nginx sub_filter 的“幽灵陷阱”:为什么页面能打开,懒加载的 JS 却全是 404?
前端