网站首页  词典首页

请输入您要查询的函数:

 

术语 setsystempowerstate
释义 SetSystemPowerState
语法:
C++
BOOL WINAPI SetSystemPowerState(
__in BOOL fSuspend,
__in BOOL fForce
);
SetSystemPowerState功能
[SetSystemPowerState都可以在指定的要求部分使用的操作系统。它可能被改变或在后续版本中不可用。为Windows Vista编写的应用程序,后来应使用SetSuspendState代替。]
挂起的系统关闭电源了。根据不同的ForceFlag参数,函数要么立即停止作业或者请求之前,所有应用程序和设备驱动程序,这样做的许可。
参数
fSuspend [in]
如果此参数为TRUE,系统暂停。如果该参数为FALSE,系统进入休眠状态。
fForce [in]
此参数没有作用。
Windows Server 2003中,Windows XP和Windows 2000的:如果该参数为TRUE,函数广播一PBT_APMSUSPEND事件,每个应用程序和驱动程序,然后立即暂停运作。如果该参数为FALSE,函数广播一PBT_APMQUERYSUSPEND事件,每个应用程序请求批准暂停运作。
返回值
如果电源已被暂停,随后恢复后,返回非零值。
如果系统没有中止,返回值是零。为了获得更多错误信息,调用GetLastError。
备注
调用进程必须有SE_SHUTDOWN_NAME特权。为了使SE_SHUTDOWN_NAME特权,使用AdjustTokenPrivileges功能。有关更多信息,请参阅更改权限的令牌。
如果任何应用程序或驱动程序拒绝批准暂停运作,职能播出PBT_APMQUERYSUSPENDFAILED事件,每个应用程序和驱动程序。如果权力被暂停,此功能后,才恢复系统的操作及有关WM_POWERBROADCAST邮件已被广播到所有的应用程序和驱动程序的回报。
这个功能类似于SetSuspendState功能。
要编译的应用程序使用此函数,定义为0x0400或更高_WIN32_WINNT宏。有关详细信息,请参阅使用Windows头。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinBase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
参见
电源管理功能
PBT_APMQUERYSUSPEND
PBT_APMQUERYSUSPENDFAILED
PBT_APMSUSPEND
SetSuspendState
WM_POWERBROADCAST
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年7月30日
==英文原文==SetSystemPowerState Function
[SetSystemPowerState is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. Applications written for Windows Vista and later should use SetSuspendState instead.]
Suspends the system by shutting power down. Depending on the ForceFlag parameter, the function either suspends operation immediately or requests permission from all applications and device drivers before doing so.
Syntax
C++
BOOL WINAPI SetSystemPowerState(
__in BOOL fSuspend,
__in BOOL fForce
);
Parameters
fSuspend [in]
If this parameter is TRUE, the system is suspended. If the parameter is FALSE, the system hibernates.
fForce [in]
This parameter has no effect.
Windows Server 2003, Windows XP, and Windows 2000: If this parameter is TRUE, the function broadcasts a PBT_APMSUSPEND event to each application and driver, then immediately suspends operation. If the parameter is FALSE, the function broadcasts a PBT_APMQUERYSUSPEND event to each application to request permission to suspend operation.
Return Value
If power has been suspended and subsequently restored, the return value is nonzero.
If the system was not suspended, the return value is zero. To get extended error information, call GetLastError .
Remarks
The calling process must have the SE_SHUTDOWN_NAME privilege. To enable the SE_SHUTDOWN_NAME privilege, use the AdjustTokenPrivileges function. For more information, see Changing Privileges in a Token .
If any application or driver denies permission to suspend operation, the function broadcasts a PBT_APMQUERYSUSPENDFAILED event to each application and driver. If power is suspended, this function returns only after system operation is resumed and related WM_POWERBROADCAST messages have been broadcast to all applications and drivers.
This function is similar to the SetSuspendState function.
To compile an application that uses this function, define the _WIN32_WINNT macro as 0x0400 or later. For more information, see Using the Windows Headers .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinBase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
See Also
Power Management Functions
PBT_APMQUERYSUSPEND
PBT_APMQUERYSUSPENDFAILED
PBT_APMSUSPEND
SetSuspendState
WM_POWERBROADCAST
Send comments about this topic to Microsoft
Build date: 7/30/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa373206(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:20:30