zoukankan      html  css  js  c++  java
  • MS UI Automation原来如此

    最近参加了公司的一个program competition,做个小工具。其中涉及到一个盲点。 需求是:在代码中访问另一个program的进程,获取它的窗口句柄,并在它的窗口上对某一个控件进行鼠标点击操作以执行相应的命令。google来baidu去,终于有思路了:原来需要用到MS的UI automation library。MS提供了面向c/c++的API,也提供了面向managed code的API。

    Extract some overview words from below MS msdn article:

    Microsoft UI Automation is an accessibility framework that enables Microsoft Windows applications to provide and consume programmatic information about user interfaces (UIs). It provides programmatic access to most UI elements on the desktop. It enables assistive technology products, such as screen readers, to provide information about the UI to end users and to manipulate the UI by means other than standard input. UI Automation also allows automated test scripts to interact with the UI. 

    详细背景信息参见:http://msdn.microsoft.com/zh-cn/library/ms726294%28en-us,VS.85%29.aspx

    就我目前体会到的,主要有这么几点:

    1. 通过这个库,我们可以做两件事情:

    The Microsoft UI Automation for Microsoft Win32 API enables assistive technology applications and automated testing tools to interact with user interface (UI) controls.

    The API is in two parts, that are used independently by UI Automation providers and by UI Automation client applications. The provider API enables developers of Win32 custom control and other control frameworks to expose those controls to UI Automation and make them visible to client applications. The client API enables applications to interact with controls.

    2. About Spy++ and UI Spy

    通过这两个工具,我们可以获取到任何一个窗口的详细UI信息,具体到一个控件的tab顺序都可以拿到。

    3. 读了几个例子:

    自动化测试工具的原理:http://www.cnblogs.com/Thomson-Blog/articles/1295729.html:

    Major Tom 的 GUI 控件:http://blog.moneypa.com/post/Major-Tom-e79a84-GUI-e68ea7e4bbb6.aspx

    Microsoft UI 自动化库http://msdn.microsoft.com/zh-cn/magazine/cc163288.aspx 

  • 相关阅读:
    简明 Vim 练级攻略
    设置命令的别名
    GPIO实验(二)
    GPIO实验(一)
    ubuntu文件夹默认列表显示
    ubuntu 12.04下gedit查看txt中文乱码解决办法
    ubuntu下超强的截图工具scrot
    原码 反码 补码 移码的关系(精简总结)
    内核编译
    [Linux] shell利用sed如何批量更改文件名详解[转载] | 不使用正则表达式,修改未知的文件名|
  • 原文地址:https://www.cnblogs.com/taoxu0903/p/1604989.html
Copyright © 2011-2022 走看看