Hi,
I was looking for a way to shut down a PC after properly closing down a running program. As Windows functions is beyond me, I was very happy to find a post by JRL containing the following code:
LibFunc>user32,ExitWindowsEx,EWEres,0,1
I've got the close-the-running-program-part working. However the shutdown-part does not run as expected.
I found the following info on the arguments for ExitWindowsEx:
The second argument is for the shutdown type. I found these possible values:
0=logoff
1=shutdown
2=reboot
4=logoff and forced termination of processes
8=poweroff
10=same as 4 + terminate hanging processes
40=restart (incl applications registered for restart)
The last argument is for the shutdown reason, which seems to be used for logging purposes mostly.
I am only able to get the logoff (argument value 0) working, all the other arguments don't seem to work and I don't understand why. could anybody enlighten me?
thanks in advance,
Tobias
how to get ExitWindowsEx to work properly
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Is there any reason why you cannot use the ShutDownWindows command?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?