Posts: 60
Threads: 21
Joined: Aug 2003
The only code I have found in the forum that comes close is :
rep
,clo "Microsoft Word"; err break
How can one close all open and minimised windows, except QM?
I use QM version 2.16
Posts: 12,140
Threads: 142
Joined: Dec 2002
;closes all visible minimized windows except qm editor
ARRAY(int) a; int i h
GetWindowList 0 "" 1 0 0 a
for i 0 a.len
,h=a[i]
,if(!IsIconic(h)) continue
,if(wintest(h "" "QM_editor")) continue
,clo h; err
Posts: 60
Threads: 21
Joined: Aug 2003
That's brilliant Gintaras. Thanks so much.
Al
Posts: 60
Threads: 21
Joined: Aug 2003
I have tested the code. It works well except for small popup windows like Norman antivirus update status messages.
What code could i include to also close this kind of popup window?
Posts: 473
Threads: 33
Joined: Aug 2007
Quote:It is difficult to determine what windows must be closed, because there are many windows that you maybe don't think that they are windows, eg desktop, taskbar, tooltips, owners of real windows, and hundreds of hidden windows. This code enumerates all visible nonpopup windows and popup windows that have caption (title bar).
ARRAY(int) a
GetWindowList 0 0 1 0 0 a
int i h
for i 0 a.len
,h=a[i]
,if(h=_hwndqm) continue ;;skip QM
,int style=GetWinStyle(h)
,if(style&WS_POPUP)
,,if(style&WS_CAPTION != WS_CAPTION) continue ;;skip windows without title bar
,,;
,out _s.getwintext(h)
,;clo h
Taking on Quick Macros one day at a time
Posts: 60
Threads: 21
Joined: Aug 2003
Thanks so much QM assistant. I appreciate your efforts.
I'll try that code.
Al
Posts: 12,140
Threads: 142
Joined: Dec 2002
I don't know how look these Norman windows. Maybe just add wintest for each window that is not minimized but must be closed anyway.
;closes all visible minimized windows except qm editor
ARRAY(int) a; int i h
GetWindowList 0 "" 1 0 0 a
for i 0 a.len
,h=a[i]
,if(!IsIconic(h)) ;;not minimzed
,,int close=0 ;;if 1, close anyway
,,if(wintest(h "window name" "window class" "etc")) close=1
,,else if(wintest(h "window name 2" "window class 2" "etc")) close=1
,,;...
,,if(!close) continue
,if(wintest(h "" "QM_editor")) continue
,clo h; err
,