我爱Aspx >> Asp.Net >> 使用C#编写的一个定时关机程序protected static void SuspendSystem(bool hibernate , bool force ){
if (!CheckEntryPoint("powrprof.dll", "SetSuspendState"))
throw new PlatformNotSupportedException("The SetSuspendState method is not supported on this system!");
SetSuspendState((int)(hibernate ? 1 : 0), (int)(force ? 1 : 0), 0);
}
/// <summary>
/// Checks whether a specified method exists on the local computer.
/// </summary>
/// <param name="library">The library that holds the method.</param>
/// <param name="method">The entry point of the requested method.</param>
/// <returns>True if the specified method is present, false otherwise.</returns>
protected static bool CheckEntryPoint(string library , string method ) {
IntPtr libPtr = LoadLibrary(library);
if (!libPtr.Equals(IntPtr.Zero)) {
Ҷƪл˵?
C#处理鼠标和键盘事件[05-20]
使用C#实现阿拉伯数字到大写中文..[05-20]
C#如何取硬件标志[05-20]
用C#快速往Excel写数据[05-20]
c# 获得局域网主机列表实例[05-20]
c# 获得局域网主机列表实例[05-20]
用C#的Raw Socket实现网络封包监..[05-20]
利用C#实现标准的 Dispose模式[05-20]
关于C#中属性及值类性引用类型的..[05-20]
c#.net常用函数列表[05-20]
得到系统进程和结束某个指定的进..[05-20]
C#处理鼠标和键盘事件[05-20]
使用C#实现阿拉伯数字到大写中文..[05-20]
C#如何取硬件标志[05-20]
用C#快速往Excel写数据[05-20]
c# 获得局域网主机列表实例[05-20]
c# 获得局域网主机列表实例[05-20]
用C#的Raw Socket实现网络封包监..[05-20]
利用C#实现标准的 Dispose模式[05-20]
关于C#中属性及值类性引用类型的..[05-20]