Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to close all open and minimised windows
#1
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
#2
Code:
Copy      Help
;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
#3
That's brilliant Gintaras. Thanks so much.

Al
#4
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?
#5
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).




Code:
Copy      Help
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
#6
Thanks so much QM assistant. I appreciate your efforts.

I'll try that code.

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

Code:
Copy      Help
;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
,


Forum Jump:


Users browsing this thread: 1 Guest(s)