Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


How to Close All Windows and Perform a Shutdown

Keywords: 	 close all windows shutdown

Question:

Answer:

Well what if you open Notepad then do a "File/Open" Then try to send it an Alt-F4. It does not try to close.

So what do you want to do there? Add some code to see ifthe FileOpen window is open, then send that an Escape to close then do an Alt-F4.

But then there are millions of programs out there. All with their own ways of not closing.

What if someone opened notepad, then typed a few characters and then did not save. Then the Do you want to save message comes up.

Big problem. I've know a few people who went thru the list of authorized applications at a company and wrote a long script that pretty much knows how to shutdown a long list of applications.

For starters...

list=WinItemizeEx("",@TRUE,@FALSE)
count=ItemCount(list,@tab)

for xx=1 to count
thiswin=ItemExtract(xx,list,@tab)

if WinExist(thiswin)
   If WinIsDOS(thiswin)
       IntControl(48,thiswin,0,0,0)
   else
       WinClose(thiswin)
   endif
endif

next
That should clear out most of them. Then perform a
IntControl(68,0,0,0,0)
or
IntControl(68,0,1,0,0)
And see if you like either of the results.
Article ID:   W14286
Filename:   Close all Windows and Shutdown.txt