This project is read-only.

Create application object for already launched application without using attach process

Jun 11, 2008 at 12:11 PM
Edited Jun 11, 2008 at 12:18 PM
        I am trying to get the Application object or Window object for an application that is already started. Pasting the code for doing it without normal UIAutomation without white.


nameCondition = new PropertyCondition(AutomationElement.NameProperty, "MyApp"); 


PropertyCondition typeCondition = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Window); 


AndCondition cond = new AndCondition(nameCondition, typeCondition); 


AutomationElement window = AutomationElement.RootElement.FindFirst(TreeScope.Element | TreeScope.Descendants, cond);

Please let me know how to get the window object without attaching to the process.  I am needing to update the process id every time i launch the app. Is there a method in which I can do that?




Jun 12, 2008 at 3:13 PM
Have you tried Application.Launch("processName")? Does your processName change everytime?
Jun 12, 2008 at 3:19 PM
Hello Vivek,
               The app i am dealing with is *already launched(. I am trying to automate it *after it has launched*.  I need to get the Application object after it has launched.
My program should run with the instance of an application object thats already there in the memory.

Jun 13, 2008 at 8:51 PM
I am sorry, I meant to say, Application.Attach("processName")?
You should be able to use this.