Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Save/Restore Window Function does not restore location for minimized windows

$
0
0

Hey Guys,

 

I was trying to figure out the best way to restore minimized windows with the following script. I was able to get the windows to restore the the original location but when they are minimized they do no restore. Any help would be greatly appreciated!

AutoIt         
#include <WindowsConstants.au3> #include <GuiConstantsEx.au3> $parentgui=GUICreate("Test", 600, 400) $windowsave = GUICtrlCreateButton ("Window Save",280,20,80,20) $windowrestore = GUICtrlCreateButton ("Window Restore",280,40,90,20) $winlist = WinList() GUISetState(@SW_SHOW) ;WINDOWS Save While 1     $iMsg = GUIGetMsg()     Switch $iMsg       GUISetState(@SW_SHOW) Case $GUI_EVENT_CLOSE Exit Case $windowsave StoreWins() msgbox (0,"Your Windws Have Been Saved, Ok to Remove from Dock", "Your Windows Have Been Saved, OK to Remove from Dock") Case $windowrestore WinSetState($winlist,"",@SW_RESTORE) RestoreWins() EndSwitch Wend Func StoreWins($file = "windows.ini")     Local $var = WinList()     If FileExists($file) Then FileDelete($file)     For $i = 1 to $var[0][0]       If IsVisible($var[$i][1]) Then         Local $pos = WinGetPos($var[$i][1])         IniWrite($file, Binary($var[$i][0]), "x", $pos[0])         IniWrite($file, Binary($var[$i][0]), "y", $pos[1])         IniWrite($file, Binary($var[$i][0]), "w", $pos[2])         IniWrite($file, Binary($var[$i][0]), "h", $pos[3])       EndIf     Next EndFunc Func RestoreWins($file = "windows.ini")     Local $var = WinList()     For $i = 1 to $var[0][0]       If IsVisible($var[$i][1]) Then         If IniRead($file, $var[$i][0], "x", False) Then             Local $pos = WinGetPos($var[$i][1])             WinMove($var[$i][0], "", IniRead($file, Binary($var[$i][0]), "x", $pos[0]), IniRead($file, Binary($var[$i][0]), "y", $pos[1]), IniRead($file, Binary($var[$i][0]), "w", $pos[2]), IniRead($file, Binary($var[$i][0]), "h", $pos[3]))         EndIf      EndIf     Next EndFunc Func IsVisible($handle)     Return BitAnd(WinGetState($handle), 2) EndFunc

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>