如何捕获在一个窗口中的数据 [英] How to capture data in a window
问题描述
我有我的机器上安装一个桌面应用程序。当我开始一个程序某种窗口的开放获取。让我们说,这样的事情(例如刚):
I have a desktop application installed on my machine. When I start a program some kind of window gets open. let's say, something like this (just example):
所以,我想C#编写的应用程序,会发现这个窗口,并从中获取一些数据。
So, I want to write an application in C# that will find this window and capture some data from it.
我应该看什么工具?我想去阻力最小的路径。
What tools should I look at? I want to go with a path of least resistance.
我要捕捉图像,从文本框的文本,也可以通过文本找到控制和点击它们。
I need to capture images, text from textboxes, and also find controls by text and click on them.
推荐答案
我建议你使用很酷,但鲜为人知的 UI自动化API
I suggest you use the cool but little-known UI Automation API for this work.
有关此,要测试的第一件事就是推出相关的 UISpy 工具。它会在屏幕上显示所有可访问的窗口的树。它也可以运行像按下一个菜单,选择项目等,这是用什么所谓一些行动UI自动化控制模式的,它提供了一种方法来分类和暴露控制的功能独立于控制型或控制的外观。
For this, the first thing to test is launch the associated UISpy tool. It will display a tree of all accessible windows on screen. It also is able to run some actions like pressing a menu, selecting an item, etc. This is using what's called UI Automation Control Patterns, which provide a way to categorize and expose a control's functionality independent of the control type or the appearance of the control.
所以,如果你可以使用自动化UI间谍这个应用程序,您还可以使用.NET代码做同样的事情(UISpy本身是简单地使用底层API)。
So, if you can automate this application with UI Spy, you also can do the exact same thing using .NET code (UISpy is itself simply using the underlying API).
下面是一个有关UI自动化编程教程有趣的文章:微软UI自动化库
Here is an interesting tutorial article about UI automation programming: The Microsoft UI Automation Library
这篇关于如何捕获在一个窗口中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!