Error accessing AutomationElement without admin

0

I'm trying to retrieve the TabsControl tab from a Windows screen, but it returns NULL when I'm not with visual studio admin.

Is there a way to do this without being admin? or has another framework that lets you do this without admin. (In the company I am I do not have admin access :()

public void ObterAbarMeuCliente()
{
    int? idProcesso = null;
    while (idProcesso == null || idProcesso == 0)
    {
        idProcesso = ProcessExtensions.ObterProcessoPorNome("Arquitetura.Base.WPF.Window");
    }

    AutomationElement ElemID = null;

    while (ElemID == null)
    {
        ElemID = AutomationExtensions.FindByChildrenProcessIdProperty(idProcesso.Value);
    }

    var guiaTabsControl = ElemID.FindByClassName("TabControl");

}

public static AutomationElement FindByClassName(this AutomationElement automationElement, string nomeDaClasse)
{
    return automationElement.Children().ToList().FirstOrDefault(a => a.Current.ClassName == nomeDaClasse);
}
    
asked by anonymous 14.08.2018 / 21:25

0 answers