Call the windows API ExitWindows or ExitWindowEx for shutting down windows.
A sample is
[ccode]
::ExitWindowsEx(EWX_LOGOFF,0) will logoff the computer;.
::ExitWindowsEx(EWX_SHUTDOWN,0) will shutdown the computer.
See the MSDN for more details about the ExitWindows and ExitWindowsEx.