亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > OS > Windows7 > 正文

win7休眠、待機api

2024-06-28 16:00:54
字體:
來源:轉載
供稿:網友

Win7休眠、待機api

通過c++讓windows進入休眠或者待機狀態。 xp、win7下用SetSystemPowerState函數,Vista及之后的版本使用 SetSuspendState函數。

xp、win7:

SetSystemPowerState

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.

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.

休眠與待機的區別 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.

待機是關閉電源(暫且將Suspends翻譯為待機)。那么言下之意休眠就不是關閉電源了。那休眠是什么狀態呢?硬盤關閉,風扇關閉,但是內存還上著電呢,用戶點擊鼠標或者鍵盤之后電腦就會自動恢復了。

而在待機狀態下,點擊鼠標鍵盤是不管用的,必須重新點開機按鈕才行。開機后進入之前保留的狀態。

臆想是上面那樣的,而MicroSoft做了更細致的劃分。

詳細介紹如下

Power state ACPI state Description
Working S0 The system is fully usable. Hardware components that are not in use can save power by entering a lower power state.
Sleep (Modern Standby) S0 low-power idle Some SoC systems support a low-power idle state known as Modern Standby. In this state, the system can very quickly switch from a low-power state to high-power state, so that it can respond quickly to hardware and network events. Systems that support Modern Standby do not use S1-S3.
Sleep S1 S2 S3 The system appears to be off. Power consumed in these states (S1-S3) is less than S0 and more than S4; S3 consumes less power than S2, and S2 consumes less power than S1. Systems typically support one of these three states, not all three. In these states (S1-S3), volatile memory is kept refreshed to maintain the system state. Some components remain powered so the computer can wake from input from the keyboard, LAN, or a USB device. Hybrid sleep, used on desktops, is where a system uses a hibernation file with S1-S3. The hibernation file saves the system state in case the system loses power while in sleep. Note SoC systems that support modern standby (the low-power idle state) do not use S1-S3.
Hibernate S4 The system appears to be off. Power consumption is reduced to the lowest level. The system saves the contents of volatile memory to a hibernation file to PReserve system state. Some components remain powered so the computer can wake from input from the keyboard, LAN, or a USB device. The working context can be restored if it is stored on nonvolatile media.Fast startup is where the user is logged off before the hibernation file is created. This allows for a smaller hibernation file, more appropriate for systems with less storage capabilities.
Soft Off S5 The system appears to be off. This state is comprised of a full shutdown and boot cycle.
Mechanical Off G3 The system is completely off and consumes no power. The system returns to the working state only after a full reboot.

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.

調用此api需要特權,通過AdjustTokenPrivileges來獲取特權。

示例

HANDLE hToken; TOKEN_PRIVILEGES tp; LUID luid; if(::OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY, &hToken)) { ::LookupPrivilegeValue(NULL,SE_SHUTDOWN_NAME,&luid); tp.PrivilegeCount=1; tp.Privileges[0].Luid =luid; tp.Privileges[0].Attributes =SE_PRIVILEGE_ENABLED; ::AdjustTokenPrivileges(hToken,false,&tp,sizeof(TOKEN_PRIVILEGES),NULL,NULL); } ::SetSystemPowerState(false,true);
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
国产精品美女免费看| 国内精品久久久久久| 日韩欧美在线字幕| 九九热r在线视频精品| 国产美女精品视频免费观看| 亚洲国产高潮在线观看| 538国产精品一区二区在线| 亚洲电影天堂av| 国产视频欧美视频| 欧美激情在线狂野欧美精品| 国产丝袜一区二区| 一本色道久久88亚洲综合88| 亚洲夜晚福利在线观看| 亚洲一区二区三区四区视频| 成人国产精品一区| 精品国产一区二区三区在线观看| 亚洲美腿欧美激情另类| 中文字幕欧美亚洲| www.久久久久久.com| 欧美极品少妇xxxxⅹ免费视频| 久久成人国产精品| 日韩有码在线电影| 久久久黄色av| 狠狠做深爱婷婷久久综合一区| 亚洲成人在线视频播放| 亚洲国产一区二区三区四区| 国产精品久久久久久搜索| 国产成人在线亚洲欧美| 亚洲白拍色综合图区| 精品国产欧美成人夜夜嗨| 在线成人激情黄色| 亚洲国产精品专区久久| 日韩在线免费视频| 精品欧美国产一区二区三区| 国产精品永久免费视频| 日韩成人在线视频| 色妞欧美日韩在线| 国产精品免费网站| 欧美中文在线观看| 91沈先生作品| 91地址最新发布| 在线观看日韩视频| 国产精品久久久久久一区二区| 日韩动漫免费观看电视剧高清| 97视频网站入口| 久久国产精品久久国产精品| 国产精品扒开腿做爽爽爽视频| 91中文字幕在线观看| 欧美日韩国产丝袜美女| 亚洲自拍偷拍一区| 亚洲国产高清高潮精品美女| 亚洲成人免费在线视频| 97超级碰碰人国产在线观看| 中文字幕一区二区三区电影| 日本精品久久久久久久| 亚洲色图偷窥自拍| 久久6免费高清热精品| 精品爽片免费看久久| 国产精品香蕉国产| 亚洲国产高清高潮精品美女| 久久久久久国产精品| 亚洲成人精品在线| 欧美成人免费全部观看天天性色| 日韩av在线高清| 日韩精品极品毛片系列视频| 日韩av毛片网| 精品国产乱码久久久久久虫虫漫画| 成人亚洲欧美一区二区三区| 久久久久久久久久国产| 中文字幕不卡在线视频极品| 国产精品久久久久久久一区探花| 日韩av在线天堂网| 88国产精品欧美一区二区三区| 欧美激情在线有限公司| 国产欧美精品日韩精品| 久久久久久久久久久人体| 久久综合国产精品台湾中文娱乐网| 欧美国产视频一区二区| 日韩中文视频免费在线观看| 国产成人一区二区三区小说| 欧美日韩免费一区| 国产69久久精品成人看| 另类色图亚洲色图| 久久国内精品一国内精品| 欧美日韩国产丝袜美女| 国产999在线观看| 久久久免费精品视频| 亚洲热线99精品视频| 国产精品扒开腿做爽爽爽视频| 91性高湖久久久久久久久_久久99| 欧美精品中文字幕一区| 欧亚精品在线观看| 欧美视频在线免费看| 亚洲成人动漫在线播放| 日韩高清人体午夜| 97视频在线观看亚洲| 国产在线视频91| 欧美最猛性xxxxx免费| 亚洲伊人久久大香线蕉av| 欧美日韩午夜激情| 欧美日韩国产色视频| 欧美日韩高清区| 日韩精品中文字幕有码专区| 国产精品国产三级国产aⅴ浪潮| 91av视频在线观看| 亚洲欧美综合精品久久成人| 久久久久一本一区二区青青蜜月| 精品日韩视频在线观看| 欧美专区福利在线| 丝袜亚洲欧美日韩综合| 欧美日韩在线视频一区二区| 亚洲一区二区免费在线| 久久精品国产99国产精品澳门| 91av在线不卡| 国产成人精品午夜| 最新中文字幕亚洲| 亚洲欧美日韩天堂一区二区| 永久555www成人免费| 136fldh精品导航福利| 亚洲无av在线中文字幕| 精品国产乱码久久久久久天美| 91精品成人久久| 这里只有精品视频| 国产成人久久久精品一区| 亚洲国产精品悠悠久久琪琪| 97国产成人精品视频| 欧美一级片免费在线| 亚洲欧美另类人妖| 2019中文在线观看| 91精品国产高清久久久久久91| 51久久精品夜色国产麻豆| 色综合影院在线| 欧美极度另类性三渗透| 精品日韩美女的视频高清| 亚洲欧洲视频在线| 精品国产91久久久久久| 久久影院免费观看| 欧美日韩精品在线| 国产精品亚洲аv天堂网| 国产精品三级美女白浆呻吟| 亚洲第一精品夜夜躁人人躁| 91中文在线视频| 岛国av一区二区三区| 影音先锋欧美在线资源| 美女视频黄免费的亚洲男人天堂| 亚洲一级一级97网| 日韩欧美国产高清91| 亚洲美女在线视频| 成人国产精品日本在线| 亚洲欧洲av一区二区| 亚洲天堂av图片| 亚洲最大福利视频网| 亚洲黄色www网站| 欧美激情女人20p| 精品久久久久久久久久| 2019国产精品自在线拍国产不卡| 久久亚洲精品小早川怜子66| 欧美视频在线看| 91久久久久久久一区二区| 国产欧美亚洲精品| 亚洲精品动漫久久久久| 成人信息集中地欧美| 国产精品丝袜久久久久久高清| 久久久av免费|