How to Shutdown [and restart] Windows 95 / NT ? 
Author Message
 How to Shutdown [and restart] Windows 95 / NT ?

I have a problem with the ExitWindowsEx API.

I'm kinda new to this so excuse me if you find something below that
might look like a dumb thing to do :)

I want to shutdown and i some cases reboot my system automatically
in a scheduled event.

I'm using Windows 95 (Version 4.00.950 B) but i want this to work
on Windows NT 4.0 also.

The ExitWindowsEx API is declared as followed :

Declare Function ExitWindowsEx& Lib "user32" (Byval uFlags As Long, ByVal
dwreserved As Long)

uFlags is type Long and you should use the OR operator when using combined
flags :

EWX_FORCE                       Forcibly terminates processes that do not respond
EWX_LOGOFF              Terminates processes, then logs off
EWX_SHUTDOWN            Shuts the system down
EWX_REBOOT              Reboots the system

My syntax is a followed :

ExitWindowsEx EWX_LOGOFF, 0

The above works and Windows logs off, but Windows also logs off
 if i use the EWX_SHUTDOWN or the EWX_REBOOT flag.

So basically, no matter what type of flag i use, Windows
simply logs off and that's it !

Can anyone tell me what i'm doing wrong ?!

If so, suppose i want to shutdown and reboot my system,
what should my syntax be like ?

Something like this ? :


What if users are connected to my system over a network (and use files
on my hardisk) ???
Normally you get a message like "There are 2 users connected with 4 open
files, do
you really want to shutdown ?".

Any help is welcome.

Thanks !


Thu, 08 Jul 1999 03:00:00 GMT  
 How to Shutdown [and restart] Windows 95 / NT ?

I'm having the same problem. There is an article on MSDN (Q149690) that
says using EWX_FORCE and EWX_LOGOFF together results in undefined behavior.
I'm also using the B version of Windows 95 and haven't tried this under an
earlier release.

Tue, 13 Jul 1999 03:00:00 GMT  
 [ 2 post ] 

 Relevant Pages 

1. How to Shutdown [and restart] Windows 95 / NT ?

2. How to Shutdown [and restart] Windows 95 / NT ?

3. Shutdown and Restart Windows 95 and NT for VB Script

4. shutdown windows nt worstation or windows 95/98

5. *Help* restarting Windows 95/NT

6. Restarting an NT Server from a Win 95 Client

7. Restarting Windows 95 from a VB App.

8. Restarting Windows 95???

9. Restart Windows 95 from VB

10. Restarting Windows 95 (And Closing all apps automatically)

11. Restarting Windows 3.1, 95?

12. Windows 95 Restart GUI


Powered by phpBB® Forum Software