Sign in to follow this  
Followers 0
DraikSword

Restore windows

6 posts in this topic

Hi all.

Which function can Restore windows in Taskbar for x(seconds) and then Minimize them?

Can I use _WinAPI_SetWindowPos ? It used "Handle of window" but I have more than 1 window to show and then minimize, how can I create a handle_list?

Share this post


Link to post
Share on other sites



Which function can Restore windows in Taskbar for x(seconds) and then Minimize them?

Look up GUISetState

how can I create a handle_list?

Look up WinList

HTH,

whim

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Thank you so much.

Share this post


Link to post
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

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.

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