Jump to content

Restore windows


Recommended Posts

WinSetState ( "Title of the window1", "", @SW_RESTORE )

WinSetState ( "Title of the window2", "", @SW_RESTORE )

Sleep(3000) ;for 3 seconds

WinSetState ( "Title of the window1", "", @SW_MINIMIZE )

WinSetState ( "Title of the window2", "", @SW_MINIMIZE )

Edited by alexxh
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
    If BitAnd(WinGetState($aWin[$i][0],""),16) then 
        WinSetState($aWin[$i][0],"",@SW_RESTORE)
        sleep(1000)
        WinSetState($aWin[$i][0],"",@SW_MINIMIZE)
    EndIf
EndIf
Next


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

  • 2 weeks later...
  • 7 months later...

#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
    If BitAnd(WinGetState($aWin[$i][0],""),16) then 
        WinSetState($aWin[$i][0],"",@SW_RESTORE)
        sleep(1000)
        WinSetState($aWin[$i][0],"",@SW_MINIMIZE)
    EndIf
EndIf
Next


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

How to tell it to Minimize Internet Explorer and/or any web browser only?

Started learning about 3 days ago so the Arrays concept is beyond me.

thanx.

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...