Jump to content

Hide all windows?


Recommended Posts

We can use the function WinMinimizeAll() to minimize all windows, but what if I want to hide all windows?

Is the a way to list the windows that WinMinimizeAll() affects?

Or would a seperate function have to be built?

I cannot use WinList(), since that returns other windows which aern't really windows(like gadgets)

Try Pacfox, my Firefox theme.Try Power Eject, my windows gadget that allows you to eject most drives.Using AutoIt 3.3.4.0, Windows 7 Premium, Intel Core 2 Quad CPU @ 2.66ghz, 4gb RAM, Nvidia GeForce 9500GT Graphics Card & Samsung 22" Monitor.
Link to comment
Share on other sites

Alternatively you exclude those windows you don't want hidden

func _getwinlist ()
Local $sExclude_List = "|Start[CL:102939]|Start|Desktop|Start Menu[CL:102938]|taskbar|iconwin|desktop[CL:102937]|Program Manager|taskbar|Menu|Save As|Drag|maincontext|"
Local $sExclude_class = "|tooltips_class32|gdkWindowToplevel|gdkWindowTempShadow|TaskSwitcherWnd|gdkWindowTemp|bosa_sdm_Microsoft Office Word 11.0|MsoCommandBarPopup|MsoCommandBarShadow|NUIDialog|CallTip|ThumbnailClass|#32770|Desktop User Picture|OfficeTooltip|"
Local $Listit
Local $aWinList = WinList()
dim $Listit[$aWinList[0][0]][5]

;Count windows

For $i = 1 To $aWinList[0][0]
;Only display visible windows that have a title
    If $aWinList[$i][0] = "" Or Not BitAND(WinGetState($aWinList[$i][1]), 2) Then ContinueLoop
;Add to array all win titles that is not in the exclude list
        $class = _WinAPI_GetClassName($aWinList[$i][1])
    If Not StringInStr($sExclude_List, "|" & $aWinList[$i][0] & "|") and Not StringInStr($sExclude_class, "|" & $class & "|") Then
        $Listit[0][1]=$Listit[0][1]+1
        $Listit[$Listit[0][1]][0]= _ProcessGetName (WinGetProcess($aWinList[$i][1]))
        $Listit[$Listit[0][1]][1]= $aWinList[$i][0]
        $Listit[$Listit[0][1]][2]= $aWinList[$i][1]
        $Listit[$Listit[0][1]][3]= $class
    EndIf 
Next
ReDim $Listit[$Listit[0][1]+1][5]
return $Listit
EndFunc
Link to comment
Share on other sites

Alternatively you exclude those windows you don't want hidden

func _getwinlist ()
Local $sExclude_List = "|Start[CL:102939]|Start|Desktop|Start Menu[CL:102938]|taskbar|iconwin|desktop[CL:102937]|Program Manager|taskbar|Menu|Save As|Drag|maincontext|"
Local $sExclude_class = "|tooltips_class32|gdkWindowToplevel|gdkWindowTempShadow|TaskSwitcherWnd|gdkWindowTemp|bosa_sdm_Microsoft Office Word 11.0|MsoCommandBarPopup|MsoCommandBarShadow|NUIDialog|CallTip|ThumbnailClass|#32770|Desktop User Picture|OfficeTooltip|"
Local $Listit
Local $aWinList = WinList()
dim $Listit[$aWinList[0][0]][5]

;Count windows

For $i = 1 To $aWinList[0][0]
;Only display visible windows that have a title
    If $aWinList[$i][0] = "" Or Not BitAND(WinGetState($aWinList[$i][1]), 2) Then ContinueLoop
;Add to array all win titles that is not in the exclude list
        $class = _WinAPI_GetClassName($aWinList[$i][1])
    If Not StringInStr($sExclude_List, "|" & $aWinList[$i][0] & "|") and Not StringInStr($sExclude_class, "|" & $class & "|") Then
        $Listit[0][1]=$Listit[0][1]+1
        $Listit[$Listit[0][1]][0]= _ProcessGetName (WinGetProcess($aWinList[$i][1]))
        $Listit[$Listit[0][1]][1]= $aWinList[$i][0]
        $Listit[$Listit[0][1]][2]= $aWinList[$i][1]
        $Listit[$Listit[0][1]][3]= $class
    EndIf 
Next
ReDim $Listit[$Listit[0][1]+1][5]
return $Listit
EndFunc

I previously used this, but because it will run on many different computers, I can't possibly put a list of every program to exclude...

In case it helps, I plan to make a Virtual Desktop app. from this...

Try Pacfox, my Firefox theme.Try Power Eject, my windows gadget that allows you to eject most drives.Using AutoIt 3.3.4.0, Windows 7 Premium, Intel Core 2 Quad CPU @ 2.66ghz, 4gb RAM, Nvidia GeForce 9500GT Graphics Card & Samsung 22" Monitor.
Link to comment
Share on other sites

#include <Array.au3>
#include <Constants.au3>
#include <windowsConstants.au3>

Dim $aWin = WinList(), $aWindows[1][1]
Dim $hUser32 = DllOpen('user32.dll')
Dim $iEx_Style, $iCounter = 0


For $i = 1 To $aWin[0][0]
$iEx_Style = BitAND(GetWindowLong($aWin[$i][1], $GWL_EXSTYLE), $WS_EX_TOOLWINDOW)
Local $iStyle = BitAND(WinGetState($aWin[$i][1]), 2)

If $iEx_Style <> -1 And Not $iEx_Style And $iStyle Then
ReDim $aWindows[$iCounter+1][1]
$aWindows[$iCounter][0] = $aWin[$i][0]
$iCounter += 1
EndIf
Next

_ArrayDisplay($aWindows)

DllClose($hUser32)


Func GetWindowLong($hWnd, $iIndex, $hUser = 'user32.dll')
Local $Ret = DllCall($hUser, 'int', 'GetWindowLong', 'hwnd', $hWnd, 'int', $iIndex)
If Not @error Then Return $Ret[0]
Return SetError(-1, 0, -1)
EndFunc

Link to comment
Share on other sites

#include <Array.au3>
#include <Constants.au3>
#include <windowsConstants.au3>

Dim $aWin = WinList(), $aWindows[1][1]
Dim $hUser32 = DllOpen('user32.dll')
Dim $iEx_Style, $iCounter = 0


For $i = 1 To $aWin[0][0]
$iEx_Style = BitAND(GetWindowLong($aWin[$i][1], $GWL_EXSTYLE), $WS_EX_TOOLWINDOW)
Local $iStyle = BitAND(WinGetState($aWin[$i][1]), 2)

If $iEx_Style <> -1 And Not $iEx_Style And $iStyle Then
ReDim $aWindows[$iCounter+1][1]
$aWindows[$iCounter][0] = $aWin[$i][0]
$iCounter += 1
EndIf
Next

_ArrayDisplay($aWindows)

DllClose($hUser32)


Func GetWindowLong($hWnd, $iIndex, $hUser = 'user32.dll')
Local $Ret = DllCall($hUser, 'int', 'GetWindowLong', 'hwnd', $hWnd, 'int', $iIndex)
If Not @error Then Return $Ret[0]
Return SetError(-1, 0, -1)
EndFunc

That's Perfect! Thanks!
Try Pacfox, my Firefox theme.Try Power Eject, my windows gadget that allows you to eject most drives.Using AutoIt 3.3.4.0, Windows 7 Premium, Intel Core 2 Quad CPU @ 2.66ghz, 4gb RAM, Nvidia GeForce 9500GT Graphics Card & Samsung 22" Monitor.
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...