How to shut down the system using dotNet?

  • Thread starter Thread starter Liang Yitao
  • Start date Start date
L

Liang Yitao

I don't know how to shut down the system with dotNet
Framework Library. Is there any class in the framework
library that offer the method like ExitWindowsEx(...) in
MFC?

Thanks a lot :)
 
No, that functionality is not in the framework. You need to use P/Invoke and
either call the legacy ExitWindowsEx API, or the newer
InitiateSystemShutdown or InitiateSystemShutdownEx. (Make sure you also
modify the token to allow shutdown).

Jerry
 
Hi,

I've got the same problem as Liang Yitao. I've read the
thread but don't exactly understand the answer. I
understand how to call the API shutdown functions.
However, I don't know what must be done and how to "make
sure the token will allow shutdown".

Any help here will be appreciated. Sample code or a
reference to sample code would be great!

Incidentally, is there a tool or listing anywhere that
predfines the WIN32 API calls for use in the .NET
framework?

Thanks.

- Neil Shore
 
Back
Top