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

# FindValue

> 在快取中查閱索引鍵與所提供索引鍵完全相符的項目。

在快取中查閱索引鍵與所提供索引鍵完全相符的項目。

呼叫此函式兩次。第一次用來擷取值的大小，第二次用來擷取資料。記憶體內的暫存儲存空間讓此呼叫模式具有良好的效能。

## 語法

```cpp theme={null}
HRESULT FindValue(
    const void  pKey,
    UINT KeySize,
    void  pValue,
    UINT  pValueSize
)
```

### 參數

*pKey*\
類型：const void \*

要查閱之項目的索引鍵。

*KeySize*\
類型：UINT

索引鍵的大小 (以位元組為單位)。

*pValue*\
類型：void \*

指向記憶體區塊的指標，該區塊會接收快取的項目。

*pValueSize*\
類型：UINT \*

指向 **UINT** 的指標，該 **UINT** 會接收快取項目的大小 (以位元組為單位)。

### 傳回值

類型：HRESULT

如果函式成功，會傳回 **S\_OK**。否則，會傳回 [**HRESULT**](https://learn.microsoft.com/en-us/windows/desktop/com/structure-of-com-error-codes) [錯誤碼](https://learn.microsoft.com/en-us/windows/win32/com/com-error-codes-10)。

| 傳回值 | 描述 |
| - | - |
| DXGI\_ERROR\_CACHE\_HASH\_COLLISION | 有一個項目的雜湊與所提供的索引鍵相同，但索引鍵並不完全相符。 |
| DXGI\_ERROR\_NOT\_FOUND | 項目不存在。 |

## 備註

## 需求

**標頭:** d3d12\_xs.h 或 d3d12\_x.h\
**程式庫:** d3d12\_xs.lib 或 d3d12\_x.lib\
**支援的平台**: XBOX Series 主機與 XBOX One 系列

## 另請參閱

* [D3D12 著色器快取 API](https://microsoft.github.io/DirectX-Specs/d3d/ShaderCache.html)


## Related topics

- [IGameInput::FindDeviceFromId](/zh-TW/reference/input/gameinput/interfaces/igameinput/methods/igameinput_finddevicefromid.md)
- [Find Lobbies](/api-reference/lobby/find-lobbies.md)
- [IGameInput::FindDeviceFromObject](/zh-TW/reference/input/gameinput/deprecated/interfaces/igameinput/methods/igameinput_finddevicefromobject.md)
- [IGameInput::FindDeviceFromPlatformString](/zh-TW/reference/input/gameinput/interfaces/igameinput/methods/igameinput_finddevicefromplatformstring.md)
- [IGameInput::FindDeviceFromPlatformHandle](/zh-TW/reference/input/gameinput/deprecated/interfaces/igameinput/methods/igameinput_finddevicefromplatformhandle.md)
