[英]How to be notified when Internet Explorer gets focus
我正在一个项目中,当Internet Explorer获得焦点或在选项卡中导航时,希望在其中通知我的程序。 为了使IE实例获得焦点或用户选择其他选项卡时更加清楚,我希望程序得到通知。
正如我在上一个问题中提到的那样,我只是尝试使用AutomationFocusChangedEventHandler
来做到这一点: AutomationFocusChangedEventHandler并不总是会触发 。 但它似乎不适用于选项卡交互。
(似乎我以前的问题很具体,所以我尝试使其更笼统)
因此,我想知道是否有一种方法可以在Internet Explorer获得焦点或用户在同一IE实例中选择不同的选项卡时通知我的应用程序?
或者,如果仍然很具体,当焦点改变时,有什么方法可以通知我的程序吗?
这是一个类似的应用程序。 看看是否有帮助。
//This Function is used to get Handle for Active Window...
[System.Runtime.InteropServices.DllImport("user32.dll", CharSet=System.Runtime.InteropServices.CharSet.Auto)]
private static extern IntPtr GetForegroundWindow();
public static IntPtr getforegroundWindow()
{
//This method is used to get Handle for Active Window using GetForegroundWindow() method present in
user32.dll
return GetForegroundWindow();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.