I'm working on a VBA program to help automate a task using UI Automation, but I've run into an issue where the window of the program I'm trying to control does not show up as a child of the Root Element (desktop).
It's my understanding that all elements are children/descendants of the desktop element, so why it's not showing up is puzzling. Here is the code I'm using to see all the children of the Desktop element:
Sub test_get_windows()
Dim oAutomation As New CUIAutomation
Dim oDesktop As UIAutomationClient.IUIAutomationElement
Dim oCondition As UIAutomationClient.IUIAutomationCondition
Dim oChilds As UIAutomationClient.IUIAutomationElementArray
Dim i As Integer
Set oDesktop = oAutomation.GetRootElement
Set oCondition = oAutomation.CreateTrueCondition
Set oChilds = oDesktop.FindAll(TreeScope_Children, oCondition)
For i = 0 To oChilds.Length - 1
Debug.Print oChilds.GetElement(i).CurrentName
Next i
End Sub
I see everything except the window I'm trying to interact with. I tried the code on another computer, and I'm able to see the window.
Computer where it doesn't work:
The AcSELerator Quickset
window does not show up on the first computer but it does on the second, so I don't think it's a problem with the application. Both computers have the same version installed and are running Windows 10 Enterprise. Any ideas on what the issue could be or any troubleshooting steps I can try?