Another way to handle Windows-Shutdowns...
You can run many Windows Function direct with the RunDLL32 program.
Now I will explain you how this will works for a shutdown ... it's very simple !!!
Just put these line in your Project:
"rundll32 shell32.dll,SHExitWindows VALUE");
Here are the different VALUES you can put in:
0 Logoff User
1 Shutdown Windows
2 Restart Windows
4 Force Applications to be killed
8 Poweroff (if supported by your PC)
-1 restart the GUI without a shutdown
You can also add values together (but the -1 value must be called alone)...
The value of 13 consists of value 1 + 4 + 8 and will force the kill of all applications and
shutdown Windows with poweroff...
There is also a function called ExitWindowsEx() in Microsofts Visual C++ which does
exactly the same... but can't handle the -1 value !!!