This code can be used to shutdown/restart/logoff the windows environment in both win 95/98 and NT/2000. It also detects which platform you are running on.
Other code posted here does not shutdown NT/2000 as it does not give the user the correct privileges. This code does.
I can not take the credit for this code though as I found it on the MSDN disks.