【问题标题】:AutoIt with wpf使用 wpf 的 AutoIt
【发布时间】:2011-12-11 16:08:10
【问题描述】:

我的 wpf 应用程序有以下示例代码。 我需要用字符串填写表单的文本字段。

    Run('AutoItWpfTesting.exe')
    WinWaitActive("Window1", "")

    $hHwnd = WinGetHandle("Window1")
    MsgBox(0, "Message", $hHwnd)

   $returnVal1=ControlGetHandle ( "$hHwnd", "", "[NAME:txtVersion]")

   $returnVal2=ControlSend($hHwnd,"","[NAME:txtVersion]","blahblah")

   MsgBox(0, "Message", $returnVal2)

$returnVal2 返回 0,$returnValue1 返回空字符串。 但是,这对于我的示例 winform 应用程序来说很好。

为什么会出现这种行为的任何线索......以及任何可用于获取精确文本框以自动填充 wpfa 应用程序数据的调整。

【问题讨论】:

    标签: wpf autoit


    【解决方案1】:

    WPF 应用程序不使用 Windows 的控件和控件句柄。您可以通过使用 Spy++ 看到这一点。 WPF Alternatives for Spy++

    如果您想自动化 WPF 应用程序 you will need another tool 或使用 the UI Automation API 构建一个。

    【讨论】:

    • 这是正确的。除此之外,您的 $hWnd 变量不应在 ControlGetHandle 调用的第一个参数中用引号引起来。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-11
    • 1970-01-01
    • 2015-08-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多