Description: [ 原创文档 本文适合初级读者 已阅读6065次 ] 文档 代码 工具
系统定时休眠
作者:jans
下载示例源代码
单位最近加强安全检查,除了部分服务器,下班不关机器的同事,都被罚了款。为此,我试着下载了几个自动关机的程序,但是都不好使。都是最后显示“你可以安全地关闭计算机了!”。到网上问了半天说是高级电源管理设置的问题。我折腾了半天,还是不行,为什么Windows自己的关机就可以关掉电源,而我们的程序就只能“你可以安全的关闭计算了!”。看来微软还不知道在哪里留了一手。
好在还有收获,最近发现MSDN还有这么一个函数
BOOL SetSystemPowerState(
BOOL fSuspend, // system state
BOOL fForce // forced suspension option
)
-[original document is suitable for primary readers have read 6,065 times] file system code tools regularly dormancy writer : jans download the source code examples unit recently enhance security inspection, except for some servers, none of machines work colleagues, are fined. To this end, I try to download several automatic shutdown procedures, but not so. The final show is "you can safely shut down the computer!" . Online asked a half-day of advanced power management settings problems. I Shetenglebantian, or not, why the shutdown of Windows can switch off the power supply, Our procedures only, "You can safely closed calculation!" . Microsoft does not seem to know where to stay in the hand. Fortunately, there are gains MSDN recently discovered there was such a function Platform: |
Size: 23235 |
Author:王勃 |
Hits:
Description: 实现休眠功能很简单,只要在任意想要执行的地方执行如下给出的休眠函数SetPower()就行,其实休眠很简单,只需要API:SetSystemPowerState()就行,就如关机/注销/重启一样,只需要ExitWindowEx(),但这些API可以直接用在98下,却不能用在2000/XP中,因为这里牵涉到了用户权限,没有权限是不能进行这些操作的,所以,首先要取得权限,下面给出代码:-achieve dormancy function is very simple, as long as the implementation of the arbitrary want the local implementation of the dormancy is as follows function SetPower () on the trip, dormancy is very simple, just API : SetSystemPowerState () on the trip, as shutdown / cancellation / restart, only ExitWindowEx (), but these APIs can be directly used in 98, not in 2000/XP can use, because it involves a user privileges, no authority can carry out these operations, therefore, must first obtain authority code is given below : Platform: |
Size: 1491 |
Author:廖良 |
Hits:
Description: 实现休眠功能很简单,只要在任意想要执行的地方执行如下给出的休眠函数SetPower()就行,其实休眠很简单,只需要API:SetSystemPowerState()就行,就如关机/注销/重启一样,只需要ExitWindowEx(),但这些API可以直接用在98下,却不能用在2000/XP中,因为这里牵涉到了用户权限,没有权限是不能进行这些操作的,所以,首先要取得权限,下面给出代码:-achieve dormancy function is very simple, as long as the implementation of the arbitrary want the local implementation of the dormancy is as follows function SetPower () on the trip, dormancy is very simple, just API : SetSystemPowerState () on the trip, as shutdown/cancellation/restart, only ExitWindowEx (), but these APIs can be directly used in 98, not in 2000/XP can use, because it involves a user privileges, no authority can carry out these operations, therefore, must first obtain authority code is given below : Platform: |
Size: 1024 |
Author:廖良 |
Hits:
Description: [ 原创文档 本文适合初级读者 已阅读6065次 ] 文档 代码 工具
系统定时休眠
作者:jans
下载示例源代码
单位最近加强安全检查,除了部分服务器,下班不关机器的同事,都被罚了款。为此,我试着下载了几个自动关机的程序,但是都不好使。都是最后显示“你可以安全地关闭计算机了!”。到网上问了半天说是高级电源管理设置的问题。我折腾了半天,还是不行,为什么Windows自己的关机就可以关掉电源,而我们的程序就只能“你可以安全的关闭计算了!”。看来微软还不知道在哪里留了一手。
好在还有收获,最近发现MSDN还有这么一个函数
BOOL SetSystemPowerState(
BOOL fSuspend, // system state
BOOL fForce // forced suspension option
)
-[original document is suitable for primary readers have read 6,065 times] file system code tools regularly dormancy writer : jans download the source code examples unit recently enhance security inspection, except for some servers, none of machines work colleagues, are fined. To this end, I try to download several automatic shutdown procedures, but not so. The final show is "you can safely shut down the computer!" . Online asked a half-day of advanced power management settings problems. I Shetenglebantian, or not, why the shutdown of Windows can switch off the power supply, Our procedures only, "You can safely closed calculation!" . Microsoft does not seem to know where to stay in the hand. Fortunately, there are gains MSDN recently discovered there was such a function Platform: |
Size: 27648 |
Author:王勃 |
Hits: