Hi,
Well, this is a different question to how to know the system status.
From Windows 2000, there is an API SetSuspendState which enable you switch
the system into Standby or Hibernate state, for more information you may
referr to
<SetSuspendState>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/power/base/
setsuspendstate.asp
For how to shutdown/Logoff the system, you may use API
ExitWindows/ExitWindowsEx, however On windows 2000 and later system, if you
want to log off /Shut down/reboot the system, your program need get the a
special privilege before calling this API. For more information you may
referr to
<ExitWindowsEx>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/bas
e/exitwindowsex.asp
There is also a sample to show you how to shutdown the system, however it's
written in C++.
Unfortunately, these APIs is not included in current release of .NET
Framework. You need use them by P/Invoke. There is an sample project on
CodeProject.com
Maybe you can take reference from it.
<Timer Computer Shutdown>
http://www.codeproject.com/csharp/timercomputershutdown.asp
Best regards,
Ying-Shen Yu [MSFT]
Microsoft community Support
Get Secure! -
www.microsoft.com/security
This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, please remove the word "online"
before sending mail.