使用Windows服务的UI自动化 [英] UI automation using windows service

查看:419
本文介绍了使用Windows服务的UI自动化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用Windows窗体时使用UI自动化,它工作正常,但是当我尝试将它与Windows服务一起使用时,我无法访问自动化元素。请提示我缺少的内容



我尝试了什么:



I was using UI automation using windows forms, it was working fine , but when i am trying to use it with Windows Service , i cannot access automation element .Please suggest what i am missing

What I have tried:

Condition Condition = new AndCondition(new PropertyCondition(AutomationElement.ProcessIdProperty, processID), new PropertyCondition(AutomationElement.AutomationIdProperty, configurationAllList.automationId));                                      
                                        AutomationElement selectedElement = AutomationElement.RootElement.FindFirst(TreeScope.Ancestors | TreeScope.Children | TreeScope.Descendants | TreeScope.Element | TreeScope.Parent | TreeScope.Subtree, Condition);

推荐答案

根据您的问题,我不知道您要做什么,但是您可以通过某种方式与Windows服务的用户界面进行通信的唯一方法进程间通信,例如远程处理,TCP / IP,WCF,用户定义的Windows消息等。
Based on your question, I have no idea what you're trying to do, but the only way you can communicate with a user interface from a Windows service is by some sort of interprocess communication, such as remoting, TCP/IP, WCF, user-defined Windows messages, etc..


这篇关于使用Windows服务的UI自动化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆