Question

I've searched for solutions in many forums but they all tell me that usign the WindowPattern and checkign the topmost value should return true if the window is on top. However, this isn't the case for me. I am testing an application that is housed within a tab in outlok. A user can then click within the application and open a new window. I'd like to verify this window is in the foreground. Also.. this is a WPF application so I cant grab separate handles for new windows that open.

thanks

Was it helpful?

Solution

This might be a terminology problem: 'Topmost' has a special meaning in Win32 (See description of WS_EX_TOPMOST here), which basically means "floats above other ordinary windows" - it's typically used for things like tooltips, menu popups, notification balloons and the like, which float above all other windows on the screen. It's rarely by actual application windows.

An application can be the currently foreground window, above other windows, but not have this property.

An alternate approach to see if the window is in the foreground is to see if it is or contains the contains the current focus or active window.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top