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

# WdTerminateRemoteGame

> WdTerminateRemoteGame

# WdTerminateRemoteGame

終止遠端裝置上最後一個使用 [WdLaunchRemoteGame](/zh-TW/reference/remoting/functions/wdlaunchremotegame) 啟動的遊戲。

## 語法

```cpp theme={null}
HRESULT WdTerminateRemoteGame(  
         _In_z_ const char* remoteDevice  
);  
```

### 參數

`_In_z_ remoteDevice`\
類型：**const char\***

遠端裝置的主機名稱或 IP 位址 (例如 `"192.168.1.100"` 或 `"MyDevKit"`)。

### 傳回值

類型：**HRESULT**

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

#### 錯誤碼

| 程式碼 | 值 | 描述 | 根本原因 | 疑難排解 |
| - | - | - | - | - |
| E\_GAMENOTRUNNING | 0x8C11400C | 沒有正在執行的遊戲處理程序。 | 目前沒有可暫停或終止的遊戲處理程序正在執行 | 驗證目前正在執行的處理程序；在使用依賴遊戲處理程序的 API 之前先啟動遊戲 |
| E\_CONNECTIONERROR | 0x8C114014 | 連線錯誤。 | 建立網路連線時發生一般性失敗 (傳輸層級失敗)，與 IP 位址有效性或遠端電腦名稱解析無關 | 檢查遠端電腦上的網路連線、防火牆規則及服務可用性；檢查裝置之間的可見性，裝置之間應能互相 ping；啟用記錄後重試連線。 |

## 備註

使用此函式終止最後一個透過 [WdLaunchRemoteGame](/zh-TW/reference/remoting/functions/wdlaunchremotegame) 啟動的遊戲。此函式會等待遊戲處理程序結束。

## 需求

| 需求 | 值 |
| - | - |
| **標頭** | WdRemoteIteration.h |
| **程式庫** | wdremoteapi.lib |
| **支援的作業系統** | Windows 11 及更新版本 |
| **支援的架構** | x64, ARM64 |

## 另請參閱

* [WdLaunchRemoteGame](/zh-TW/reference/remoting/functions/wdlaunchremotegame)
* [WdResumeRemoteGame](/zh-TW/reference/remoting/functions/wdresumeremotegame)
* [XBOX PC Remote Iteration API 錯誤碼](/zh-TW/reference/remoting/error-codes)
* [XBOX PC Remote Iteration API](/zh-TW/reference/remoting/remoteiteration_members)


## Related topics

- [WdTerminateRemoteGame](/reference/remoting/functions/wdterminateremotegame.md)
- [WdResumeRemoteGame](/ko/reference/remoting/functions/wdresumeremotegame.md)
- [WdLaunchRemoteGame](/reference/remoting/functions/wdlaunchremotegame.md)
