I need to create a form where AlwaysOnTop = True when the browser is visible. 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.
- 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.