> ## 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

Terminates the last game launched using [WdLaunchRemoteGame](/reference/remoting/functions/wdlaunchremotegame) on a remote device.

## Syntax

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

### Parameters

`_In_z_ remoteDevice`\
Type: **const char\***

The hostname or IP address of the remote device (e.g., `"192.168.1.100"` or `"MyDevKit"`).

### Return value

Type: **HRESULT**

Returns `S_OK` if successful; otherwise, returns an error code.

#### Error codes

| Code               | Value      | Description                 | Root Cause                                                                                                                                             | Troubleshooting                                                                                                                                                                                              |
| ------------------ | ---------- | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| E\_GAMENOTRUNNING  | 0x8C11400C | No game process is running. | There is no game process currently executing that can be suspended or terminated                                                                       | Verify processes currently running; Launch the game before exercising game-process dependent API                                                                                                             |
| E\_CONNECTIONERROR | 0x8C114014 | Connection error.           | Generic failure when establishing the network connection (transport‑level failure), unrelated to ip address validity or remote machine name resolution | Check network connectivity, firewall rules, service availability on the remote machine; Check visibility between devices, they should be able to ping each other; Retry the connection with logging enabled. |

## Remarks

Use this function to terminate the last game that was launched via [WdLaunchRemoteGame](/reference/remoting/functions/wdlaunchremotegame). The function waits for the game process to exit.

## Requirements

| Requirement                 | Value                |
| --------------------------- | -------------------- |
| **Header**                  | WdRemoteIteration.h  |
| **Library**                 | wdremoteapi.lib      |
| **Supported OS**            | Windows 11 and later |
| **Supported architectures** | x64, ARM64           |

## See also

* [WdLaunchRemoteGame](/reference/remoting/functions/wdlaunchremotegame)
* [WdResumeRemoteGame](/reference/remoting/functions/wdresumeremotegame)
* [XBOX PC Remote Iteration API Error Codes](/reference/remoting/error-codes)
* [XBOX PC Remote Iteration API](/reference/remoting/remoteiteration_members)


## Related topics

- [WdResumeRemoteGame](/reference/remoting/functions/wdresumeremotegame.md)
- [WdLaunchRemoteGame](/reference/remoting/functions/wdlaunchremotegame.md)
- [XBOX PC Remote Iteration API](/reference/remoting/remoteiteration_members.md)
- [XBOX PC Remote (wdRemote.exe)](/tools/tools-pc/commandlinetools/gr-wdRemote.md)
- [WdRegisterRemoteXboxGame](/reference/remoting/functions/wdregisterremotexboxgame.md)
