I have a C# application, which uses Microsoft UI Automation functionality, e. g. a call like AutomationElement.RootElement.FindFirst(...)
.
Now I need to do the same thing (use MS UI Automation) in Delphi 2009.
How can I
a) declare that my Delphi code uses MS UI Automation library and
b) make calls like AutomationElement.RootElement.FindFirst(...)
?
There are several tutorials (tutorial 1, tutorial 2) explaining how to package one's own .NET code so that it can be used with Delphi, but in my case I need to use "pre-packaged" (already installed) assembly in Delphi.
Update 1
Now I can get access to AutomationElement.RootElemeent
on one machine, but it doesn't work on another.
How can I find out the reason, why the attempt to execute uiAutomation := CoCUIAutomation.Create;
fails on the second machine?
As stated in the comments you have to import the UI Automation type library (COM Object) into your project, this can be done with the "Import Component" wizard (Component -> Import Component) in Delphi 2010.
Microsoft kept the COM Object's interface really close to it's .NET counterpart so you shouldn't have much trouble to use it if you are already familiar with the .NET automation library.