有没有办法找到屏幕上最后失去焦点的哪个窗口?我愿意使用以下任何一种方法:
我试过Automation.AddAutomationFocusChangedEventHandler(OnFocusChangedHandler)
但它只提供了有关新窗口的详细信息。我想知道有没有办法让哪个窗口丢失(没有获得)焦点?
有什么建议吗?
由于
Edit1:我想避免民意调查。这将是最后的手段。
Edit2:MSDN说UI自动化提供了这个
Automation.AddAutomationFocusChangedEventHandler(focusHandler);
void OnFocusChange(object src, AutomationFocusChangedEventArgs e)
{
//MSDN Says that here we get the elements that have lost and received focus.
// I am getting the element which received focus by doing
AutomationElement element = src as AutomationElement;
//element.Current gives the element that received focus
//i was not able to get anything which gives the element that lost focus
}