I am trying to ensure that the WPF window remains on top while it is open. It acts as a popup menu TopMost = true, and the call to win32 SetWindowPos is TOPMOST. When you first open it, it appears on top of another running application on the desktop - maximized or not.
If the user activates or uses the window in the application, mine will lose focus and disappear.
I thought about manipulating another application window by setting it to the z subscript. How to find the application window? How to sort through all windows? (This question still stands, even if this is not the right approach).
I would use SetWindowPos, GetForegroundWindow, GetForegroundWindow, GetDesktopWindow and so on.
I suspect that as soon as the user clicks in his application, he will still focus it independently, and I bark the wrong tree.
Currently, my application is a black box, and I cannot deal with it in another way, for example, periodically forwarding my application for focusing.
I also thought about having a long background thread that periodically focuses the WPF popup, but I need to look at the resources and the processor.
Yours faithfully,
source
share