Click here to Skip to main content
15,888,461 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
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:

C#
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);
Posted
Updated 29-Sep-16 4:36am
v2
Comments
Richard MacCutchan 29-Sep-16 6:29am    
You cannot access the UI from a Windows service.

1 solution

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..
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900