问题
I'm able to get some IUIAutomationElements inside Windows applications ONLY when an app 'X' (Inspect.exe | Narrator.exe | Magnify.exe) is running. Without 'X' running, the application from which I'm trying the get the IUAutomationElement essentially becomes a black box. For example, inside Microsoft Excel, I can obtain the cell identifier ( A1, D6, etc., ) when 'X' is running. Without 'X' in the background, the most granular detail I get is the Excel Workbook itself.
I've tried setting uiAccess=true and signing the application (using http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/Manifest+Manifest~Faqs.txt), moving it to Secure (Program Files) location and that hasn't worked.
FYI : Dev Env : C++ Project, Microsoft Visual Studio 2015, Community Edition.
回答1:
In general, for UI automation to work, the application that is automated must run at same UAC level than the application that automates it.
So for example, if Excel is not ran as admin, the automating application must not run as admin, or if Excel is ran as admin, the automating application must run as admin, etc.
来源:https://stackoverflow.com/questions/42383170/unable-to-get-deepest-iuiautomationelement-without-one-of-inspect-exe-magnify-e