> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ShutdownConsole

> IXtfConsoleControlClient::ShutdownConsole

# IXtfConsoleControlClient::ShutdownConsole

關閉開發主機。

## 語法

```cpp theme={null}
HRESULT ShutdownConsole(
         DWORD dwFlags
)  
```

### 參數

*dwFlags*\
類型：DWORD

旗標的位元 OR 組合，用於指定如何關閉開發主機。下表列出可用的旗標：

| 值 | 常數 | 描述 |
| - | - | - |
| 0x00000001 | XTFSHUTDOWN\_REBOOT | 關閉並重新啟動開發主機。 |
| 0x00000002 | XTFSHUTDOWN\_POWER\_MODE\_AWARE | 根據主機的電源模式設定關閉並重新啟動開發主機。 |

### 傳回值

類型：HRESULT

如果成功，則傳回 `S_OK`；否則傳回 HRESULT 錯誤碼。

## 備註

此函式會依據 `dwFlags` 中指定的旗標組合，關閉目前的開發主機。如果在叫用函式時系統尚未準備好接受關機要求，函式會包含重試邏輯，例如在無法存取 System OS 時，改為使用 Host OS 作為後援來嘗試關閉主機。函式會持續嘗試關閉主機，直到成功，或在 5 分鐘後逾時並傳回錯誤為止。

如需使用 XBOX Tools Framework (XTF) 關閉及重新啟動主機的詳細資訊，請參閱[重新開機 (xbreboot.exe) (NDA 主題)](https://docs.xbox.com/zh-TW/tools/tools-console/commandlinetools/xbreboot.md)。

## 需求

**標頭：** xtfconsolecontrol.h

**程式庫：** xtfconsolecontrol.lib

**支援的平台：** Windows (適用於 XBOX 主機工具)

## 另請參閱

[IXtfConsoleControlClient](https://docs.xbox.com/zh-TW/reference/tools/xtf/xtfconsolecontrol/interfaces/IXtfConsoleControlClient/ixtfconsolecontrolclient.md)\
[XtfConsoleControl](https://docs.xbox.com/zh-TW/reference/tools/xtf/xtfconsolecontrol/xtfconsolecontrol_members.md)


## Related topics

- [IXtfConsoleControlClient (介面內容)](https://docs.xbox.com/zh-TW/reference/tools/xtf/xtfconsolecontrol/interfaces/IXtfConsoleControlClient/ixtfconsolecontrolclient.md)
- [Shutdown Multiplayer Server](https://docs.xbox.com/api-reference/multiplayerserver/shutdown-multiplayer-server.md)
- [XtfShutdownTitleOS](https://docs.xbox.com/zh-TW/reference/tools/xtf/xtfapi/functions/xtfshutdowntitleos-xtfapi-xbox-windows-m.md)
- [MsQuic](https://docs.xbox.com/zh-TW/build/console-features/networking/game-mesh/msquic-intro-networking.md)
- [關閉多人遊戲伺服器](https://docs.xbox.com/zh-TW/services/playfab/api-references/rest/multiplayer/multiplayer-server/shutdown-multiplayer-server.md)
