一个C#类,可实现关机、重启、注销功能,首先要引用 using System.Runtime.InteropServices;
代码:
public class Shudown
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
internal struct TokPriv1Luid
{
public int Count;
public long Luid;
public int Attr;
}
[DllImport("kernel32.dll", ExactSpelling = true)]
internal static extern IntPtr GetCurrentProcess();
[DllImport("advapi32.dll", ExactSpelling = true, SetL...
c#, 关机, 注销, 类, 重启阅读全文