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.

Anees
  • 885
  • 4
  • 13
  • 31

1 Answers1

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.

Community
  • 1
  • 1
Emond
  • 50,210
  • 11
  • 84
  • 115
  • This is correct. Aside from that, your $hWnd variable should not be in quotes in the first parameter of the ControlGetHandle call. – Jos van Egmond Oct 20 '11 at 11:23