Code to Automatically Minimize Open Windows
Keywords: winzoom winhide minimize
Code to automatically minimize all open windows.There is a .SCF file in the Windows System directory that can 'show the desktop'. In other words, minimize *all* windows. This seems to work on *all* platforms *except* Windows NT 4.0, which doesn't seem to support this file.
showdesktop=strcat(DirWindows(1),"Show Desktop.scf") If FileExist(showdesktop) ShellExecute(showdesktop,"",DirWindows(1),@NORMAL,"") EndifOr if you want to run this script on NT 4.0 or if the 'Show Desktop.scf' file doesn't exist. Give this a shot:list=WinItemize() count=ItemCount(list,@tab) for xx=1 to count thiswin=ItemExtract(xx,list,@tab) if WinState(thiswin)==@HIDDEN then continue WinIconize(thiswin) nextoroShell = ObjectOpen("Shell.Application") oShell.MinimizeAll ObjectClose(oShell)Other Options
Here's some code extracted from (and slightly edited from) the INSTALL.WBT example file.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;SetupSplash iconizes all windows :setupsplash OrigWindowList=WinItemize() ;Get list of all open Windows OrigWindowCount=ItemCount(OrigWindowList,@tab) for i=1 to OrigWindowCount a=ItemExtract(i,OrigWindowList,@tab) b = WinState(a) OrigWindowState%i% = b ; Note we could hide the other windows here, but if the install ; bombs kind of bad, it leaves the user in a lurch and they ; got to reboot. Bad news. With icons they can always recover ; by themselves. if b!=@HIDDEN && b!=@ICON && WinExist(a) then WinIconize(a) next return ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;UnSplash undoes Setup Splash :UnSplash ErrorMode(@off) for i= OrigWindowCount to 1 by -1 a=ItemExtract(i,OrigWindowList,@tab) switch OrigWindowState%i% case @HIDDEN break case @NORMAL WinShow(a) break case @ICON break case @ZOOMED WinZoom(a) break end switch next ErrorMode(@cancel) returnAdditional Notes:
Windows can be zoomed, but hidden.ZOOMED, NORMAL and ICON are one set of states.
SHOWING and HIDDEN are a different set of states. WinShow goes with WinHide (if all else fails, try WinActivate).
WinZoom, WinIconize and WinShow are another set of functions.
(WinShow appears twice above. There is no easy way to handle the situation - all the possible ways of changing the Windows simply doesn't exist.)
Article ID: W13744Filename: Code to Automatically Minimize Open Windows.txt