Sign in to follow this  
Followers 0
JusGellin

List all Windows that have WinSetOnTop set

5 posts in this topic

I'm making an application that can set the active window to be on top or not using hotkeys. I know how to do this part.

But how can I list all the windows that have been set to always be on time? I want to be able list all of them and then put them back to normal mode using my code. Thanks

Share this post


Link to post
Share on other sites



Use GetWindowLong to get extended styles. Then go through with WinList and see which ones have $WS_EX_TOPMOST set. The help for WinList already does this almost, we just have to add the check for the extended style

#include <WinAPI.au3>
#include <Misc.au3>

$aWin = WinList()
$iExStyles = 0

For $x = 1 to $aWin[0][0]
    $iExStyles = _WinAPI_GetWindowLong($aWin[$x][1],$GWL_EXSTYLE)
    If $aWin[$x][0] <> "" AND IsVisible($aWin[$x][1]) Then
        If BitAND($iExStyles,$WS_EX_TOPMOST) Then
            msgbox(1,"",$aWin[$x][0] & " is Topmost")
        EndIf
    EndIf
Next
    
Func IsVisible($handle)
  If BitAnd( WinGetState($handle), 2 ) Then 
    Return 1
  Else
    Return 0
  EndIf

EndFunc

Share this post


Link to post
Share on other sites

Fantastic!! It works great. How did you know how to do this? Did you know this already or just know where to look?

Thanks so very much, I really appreciate it.

Share this post


Link to post
Share on other sites

Thanks for the encouragement and tips. This is really good stuff. I'm going to look into this.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0