I am not able to get any "title bar" object of a window via UI automation client. Here the Powershell demo code I am using, but the result is always empty. Even if I list all child-elements of a CMD-window it shows all other elements, but not the title bar. What is wrong here?
Add-Type -AssemblyName 'UIAutomationClient'
$cTrue = [Windows.Automation.PropertyCondition]::TrueCondition
$root = [Windows.Automation.AutomationElement]::RootElement
$cmd = $root.FindAll("Children", $cTrue).where{$_.current.name -eq 'Command Prompt'}
$bar = [System.Windows.Automation.ControlType]::TitleBar
$prop = [System.Windows.Automation.AutomationElement]::ControlTypeProperty
$cond = [System.Windows.Automation.PropertyCondition]::new($prop, $bar)
$cmd.FindFirst("Children", $cond)