如何在另一个进程中获取有关Qt列表框内容的信息
我有一个使用 Qt 编写的应用程序,我想读取 Qt 列表框中的数据。 它不响应 LB_GETTEXT 或其他 Windows 消息,有没有一种好方法可以从另一个进程中获取数据?
我无法访问 Qt 进程及其外部程序。我正在寻找一种从 C# 访问 LB 内容的方法。
事实证明,Qt 有一个辅助功能插件,应该为所需的操作提供支持。然而,我对 QT 很菜鸟,我不清楚应用程序是否必须在允许可访问性的情况下构建,或者是否可以为任何应用程序打开和关闭它的功能(或者至少是默认构建应用程序,未明确禁用可访问性)。
我已阅读,它说您需要运行导出 QT_ACCESSIBILITY=1,放置 qt.conf 文件并将可访问文件夹放入主根中的 Qt 应用程序。我想我完全不明白如何将 QT_ACCESSIBILITY=1 以及它应该足以使应用程序变得可访问。我将 QT_ACCESSIBILITY=1 添加到我的计算机属性的环境变量中,应该可以解决问题吗?或者导出 QT_ACCESSIBILITY=1 是不同的。
谢谢
I got an application written using Qt and I would like to read data in Qt listbox.
It doesnt respond to LB_GETTEXT or other windows messages, is there a good way to get data from it from another process?
I have no access to Qt process, its external program. I am looking for a way to access LB contents from C#.
As it turns out there is Accessibility plugin for Qt that is supposed to provide support for required operations. However I am noob with QT and its unclear to me whether application has to be build with accessibility allowed or its a feature that can be turned on and off for any application ( or at least default build applicaiton, with accessibility not being disabled explicitly).
I have read and it says you need to run export QT_ACCESSIBILITY=1, place qt.conf file and put accessible folder to Qt app in main root. I think I dont understand completely how to turn QT_ACCESSIBILITY=1 and whever it should be enough for application to become accessible. ive added QT_ACCESSIBILITY=1 into environment variables in my computer properties, should that do the trick? Or export QT_ACCESSIBILITY=1 is something different.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你不能轻易做到这一点,因为 Qt 不使用标准 Windows 控件来实现它的小部件,因此你不能使用标准 Windows Api 方法(函数/消息/windows ipc)轻松访问它的内容。您将需要以某种方式破解它的内存(不真正推荐)或使用一些支持 Qt 的 gui(测试)自动化工具,例如 挤压。
LE:您可能还想通过强制加载 Qt Accessible Plug-in 来检查此 hack
进入应用程序,然后尝试使用 Visual Studio 中包含的 Microsoft Spy++ 等常用工具进行检查。请参阅 1 和 2。
You can't easily do that, since Qt doesn't use standard Windows controls to implement it's widgets, thus you can't easily access it's contents using standard Windows Api methods(functions/messages/windows ipc). You will need to somehow hack trough it's memory(not really recommended) or use some gui (testing) automation tool that supports Qt like Squish.
LE: You might also want to check this hack by forcing the loading of Qt Accessible Plug-in
into the application and then trying to inspect using usual tools like Microsoft's Spy++ included in Visual Studio. See 1 and 2.
您可能希望将进程间通信用于以下目的:http://doc.qt。 io/archives/qt-4.7/ipc.html
You might want to use interprocess communication for these purposes: http://doc.qt.io/archives/qt-4.7/ipc.html