• λ我爱Aspx >> Asp.Net >> 使用C#编写的一个定时关机程序
  • 使用C#编写的一个定时关机程序

  • :未知  Դ:internet  :2007-5-20 16:43:52  ؼ:c#
  • /// Exits windows (and tries to enable any required access rights, if necesarry).

    /// </summary>

    /// <param name="how">One of the RestartOptions values that specifies how to exit windows.</param>

    /// <param name="force">True if the exit has to be forced, false otherwise.</param>

    /// <remarks>This method cannot hibernate or suspend the system.</remarks>

    /// <exception cref="PrivilegeException">There was an error while requesting a required privilege.</exception>

    protected static void ExitWindows(int how , bool force ) {

    EnableToken("SeShutdownPrivilege");

    if (force )

    how = how | EWX_FORCE;

    if (ExitWindowsEx(how, 0) == 0)

    throw new PrivilegeException(FormatError(Marshal.GetLastWin32Error()));

    }

    /// <summary>

    /// Tries to enable the specified privilege.

    Ҷƪл˵?
  • һƪ使用C#控制远程计算机的服务
    һƪ得到系统进程和结束某个指定的进程