4

I have below sample code for my wpf app. I need to fill in text fields of form with strings.

    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)

it returns 0 for $returnVal2 and Empty string for $returnValue1. However this works fine for my sample winform application.

Any clues why this behaviour is..and Any tweaks available to get exact text-box to auto fill data for wpfa app.

1 Answer 1

9

WPF applications do not use Windows' controls and handles for the controls. You can see that by using Spy++. WPF Alternatives for Spy++

If you want to automate WPF applications you will need another tool or use the UI Automation API to build one.

Sign up to request clarification or add additional context in comments.

1 Comment

This is correct. Aside from that, your $hWnd variable should not be in quotes in the first parameter of the ControlGetHandle call.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.