protected internal IUiElement GetActiveWindow()
{
IUiElement result = null;
try {
IntPtr hWnd =
NativeMethods.GetForegroundWindow();
if (hWnd == IntPtr.Zero) return result;
result =
AutomationFactory.GetUiElement(classic.AutomationElement.FromHandle(hWnd));
WriteVerbose(
this,
"the active window element is " +
// 20140312
// result.Current.Name);
result.GetCurrent().Name);
} catch (Exception e) {
WriteVerbose(this, e.Message);
}
return result;
}
#endregion get active window