public static AutomationElement FromPoint(Point pt)
{
try
{
UIAutomationClient.IUIAutomationElement element =
Automation.Factory.ElementFromPointBuildCache(
Utility.PointManagedToNative(pt),
CacheRequest.CurrentNativeCacheRequest);
return AutomationElement.Wrap(element);
}
catch (System.Runtime.InteropServices.COMException e)
{
Exception newEx; if (Utility.ConvertException(e, out newEx)) { throw newEx; } else { throw; }
}
}