Jump to content

List all Windows that have WinSetOnTop set


 Share

Recommended Posts

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

Link to comment
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
Link to comment
Share on other sites

Get familiar with the Windows API. It can be confusing at first, but once you figure out the basic concepts you can find some neato stuff. A lot of autoit functions are wrappers for these. And there's a bunch of _WinAPI functions in the help. ->

http://msdn2.microsoft.com/en-us/library/a...688(VS.85).aspx

http://msdn2.microsoft.com/en-us/library/a...686(VS.85).aspx

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...