WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Reboot and Shutdown Topics

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

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
File Created: 1999:10:26:11:23:04
Last Updated: 1999:10:26:11:23:04