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

# WdCreateCancellationHandle

> WdCreateCancellationHandle

# WdCreateCancellationHandle

[WdRemoteCopy](/reference/remoting/functions/wdremotecopy) で開始されたコピー操作をキャンセルするために使用できるキャンセル ハンドルを作成します。

## 構文

```cpp theme={null}
HRESULT WdCreateCancellationHandle(  
         _Out_ WdCancellationHandle* cancellationHandle  
);  
```

### パラメーター

`_Out_ cancellationHandle`\
Type: **[WdCancellationHandle](/reference/remoting/structs/wdcancellationhandle)\***

新しく作成されたキャンセル ハンドルを受け取ります。呼び出し元は、不要になったときに [WdCloseCancellationHandle](/reference/remoting/functions/wdclosecancellationhandle) を呼び出してこのハンドルを解放する必要があります。

### 戻り値

Type: **HRESULT**

成功した場合は `S_OK` を返します。それ以外の場合はエラー コードを返します。

## 解説

コピー操作を開始する前に `WdCreateCancellationHandle` を呼び出して、キャンセルを有効にするハンドルを取得します。`cancellationHandle` パラメーターを介して `WdRemoteCopy` にハンドルを渡し、次に別のスレッドから `WdCancelRemoteCopy` にそれを渡して操作をキャンセルします。

`WdRemoteCopy` が戻った後、[WdCloseCancellationHandle](/reference/remoting/functions/wdclosecancellationhandle) を呼び出してハンドルを閉じます。ハンドルは複数の `WdRemoteCopy` 呼び出しにわたって再利用できますが、各ハンドルは最終的に閉じる必要があります。

## 要件

| 要件                   | 値                   |
| -------------------- | ------------------- |
| **ヘッダー**             | WdRemoteIteration.h |
| **ライブラリ**            | wdremoteapi.lib     |
| **サポートされている OS**     | Windows 11 以降       |
| **サポートされているアーキテクチャ** | x64、ARM64           |

## 関連項目

* [WdCloseCancellationHandle](/reference/remoting/functions/wdclosecancellationhandle)
* [WdDuplicateCancellationHandle](/reference/remoting/functions/wdduplicatecancellationhandle)
* [WdCancellationHandle](/reference/remoting/structs/wdcancellationhandle)
* [WdRemoteCopy](/reference/remoting/functions/wdremotecopy)
* [WdCancelRemoteCopy](/reference/remoting/functions/wdcancelremotecopy)
* [XBOX PC Remote Iteration API](/reference/remoting/remoteiteration_members)


## Related topics

- [WdCancellationHandle](/ja-jp/reference/remoting/structs/wdcancellationhandle.md)
- [WdCloseCancellationHandle](/ja-jp/reference/remoting/functions/wdclosecancellationhandle.md)
- [WdDuplicateCancellationHandle](/ja-jp/reference/remoting/functions/wdduplicatecancellationhandle.md)
- [WdCancelRemoteCopy](/ja-jp/reference/remoting/functions/wdcancelremotecopy.md)
- [WdRemoteCopy](/ja-jp/reference/remoting/functions/wdremotecopy.md)
