Application.SetSuspendState(PowerState, Boolean, Boolean) 方法

定義

暫停或休眠系統,或請求暫停或休眠。

public:
 static bool SetSuspendState(System::Windows::Forms::PowerState state, bool force, bool disableWakeEvent);
public static bool SetSuspendState(System.Windows.Forms.PowerState state, bool force, bool disableWakeEvent);
static member SetSuspendState : System.Windows.Forms.PowerState * bool * bool -> bool
Public Shared Function SetSuspendState (state As PowerState, force As Boolean, disableWakeEvent As Boolean) As Boolean

參數

state
PowerState

A PowerState 表示要轉換到的功率活動模式。

force
Boolean

true 立即強制暫停模式;false 導致 Windows 向每個應用程式發送暫停請求。

disableWakeEvent
Boolean

true 在喚醒事件時,無法將系統電源狀態恢復為啟用, false 以啟用在喚醒事件時恢復系統電源狀態為有效。

傳回

true如果系統正在暫停,否則 。 false

備註

若應用程式在 20 秒內未回應暫停請求,Windows 會判定其處於非回應狀態,應用程式可選擇進入休眠或終止。 然而,一旦應用程式回應暫停請求,可能需要花時間清理資源並關閉活躍程序。

適用於

另請參閱