简体   繁体   English

获取第二个活动窗口vb.net

[英]Get second active window vb.net

I need to create a form where AlwaysOnTop = True when the browser is visible. 当浏览器可见时,我需要创建一个其中AlwaysOnTop = True的表单。 This creates some sort over "overlay". 这会在“覆盖”上创建某种排序。 The logic works like this: 逻辑如下所示:

  • The program checks which window is active. 程序检查哪个窗口处于活动状态。
  • If the active windows is a certain process, my form will initialize the TopMost utility, and be the active window itself. 如果活动窗口是某个进程,则我的表单将初始化TopMost实用程序,并成为活动窗口本身。
  • When the certain process is not the active window anymore, my form will disappear. 当某个进程不再是活动窗口时,我的表单将消失。

How I did it: 我是怎么做到的:

  • My program checks if a browser is the active window, if so: the form gets topmost and the program stops checking what the active window is. 我的程序检查浏览器是否是活动窗口,如果是:窗体位于最顶层,并且程序停止检查活动窗口是什么。 (because my topmost form is the active window now). (因为我最重要的表单现在是活动窗口)。
  • Now the program needs to check what the window under my form is, the second active window. 现在程序需要检查我的窗体下的窗口是第二个活动窗口。
  • If it's not the browser anymore, the form needs to hide, and the program will check what the active window is again. 如果不再是浏览器,则需要隐藏该表单,程序将再次检查活动窗口。

I already completed the function that checks what the first active window is, 我已经完成了检查第一个活动窗口是什么的功能,

I'm stuck on getting the function that checks what the second active window is. 我一直在获取检查第二个活动窗口是什么的功能。

I'm not sure that there's such as thing as a "Second active window" - its either active or its not. 我不确定是否存在诸如“第二活动窗口”之类的东西-它是活动的还是不活动的。

Why don't your leave you active window checker running after the first step of detecting the browser. 在第一步检测到浏览器之后,为什么不让活动窗口检查器运行?

You can detect when the active window is no longer your form and hide your overlay then. 您可以检测到活动窗口何时不再是您的窗体,然后隐藏您的叠加层。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM