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

# XtfGetErrorTextA

> XtfGetErrorTextA

# XtfGetErrorTextA

取得指定 `HRESULT` 的易懂錯誤訊息與使用者動作文字。

<a id="syntaxSection" />

## 語法

```cpp theme={null}
HRESULT XtfGetErrorTextA(
         HRESULT HResult,
         PSTR *errorMessageBuffer,
         UINT32 *errorMessageBufferLength,
         PSTR *userActionTextBuffer,
         UINT32 *userActionTextBufferLength
)  
```

<a id="parametersSection" />

### 參數

*HResult*\
類型：HRESULT

\[in] 要查詢其錯誤訊息與使用者動作文字的 `HRESULT`。

*errorMessageBuffer*\
類型：PSTR\*

\[out] 指向以 null 結尾字串形式接收錯誤訊息之緩衝區的指標。若要判斷所需的緩衝區長度，請將此參數設定為 `nullptr`，並將 *errorMessageBufferLength* 參數設定為 0。叫用時，*errorMessageBufferLength* 會設定為所需緩衝區的長度 (以 CHAR 為單位)，包括結尾的 null 字元。

*errorMessageBufferLength*\
類型：UINT32\*

\[in, out] 輸入時為錯誤訊息緩衝區的長度 (以 CHAR 為單位)。緩衝區長度必須包含結尾 null 字元的空間。輸出時為 **errorMessageBuffer** 所需的長度 (以 CHAR 為單位)

*userActionTextBuffer*\
類型：PSTR\*

\[out] 指向以 null 結尾字串形式接收使用者動作文字之緩衝區的指標。若要判斷所需的緩衝區長度，請將此參數設定為 `nullptr`，並將 *userActionTextBufferLength* 參數設定為 0。叫用時，*userActionTextBufferLength* 會設定為所需緩衝區的長度 (以 CHAR 為單位)，包括結尾的 null 字元。

*userActionTextBufferLength*\
類型：UINT32\*

\[in, out] 使用者動作文字緩衝區的長度 (以 CHAR 為單位)。緩衝區長度必須包含結尾 null 字元的空間。

<a id="retvalSection" />

### 傳回值

類型：HRESULT

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

如果傳回 `S_OK`，表示函式成功。`errorMessageBuffer` 與 `userActionTextBuffer` 會分別設定為指定 `HRESULT` 的錯誤訊息與使用者動作文字。

如果傳回 `HRESULT_FROM_WIN32(ERROR_MORE_DATA)`，表示為 `errorMessageBuffer` 或 `userActionTextBuffer` 提供的緩衝區不夠大。`errorMessageBufferLength` 與 `userActionTextBufferLength` 會分別設定為指定 `HRESULT` 之錯誤訊息與使用者動作文字所需的緩衝區長度。

如果傳回任何其他 HRESULT 代碼，表示發生未預期的錯誤。

<a id="remarksSection" />

## 備註

如果傳遞給 `XtfGetErrorText` 的 `HRESULT` 不是可辨識的 XBOX Tools Framework (XTF) 錯誤碼，`errorMessageBuffer` 會設定為 "Unspecified error"。您可以使用此結果來檢查指定的 `HRESULT` 是否為可辨識的 XTF 錯誤碼。如需可辨識之 XTF 錯誤碼的詳細資訊，請參閱 [XTF 傳輸錯誤 (NDA 主題)](/zh-TW/tools/tools-console/commandlinetools/xtf-transport-errors)。

<a id="requirementsSection" />

## 需求

**標頭：** xtfapi.h

**程式庫：** XtfApi.lib

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

<a id="seealsoSection" />

## 另請參閱

[XtfConsoleControl](/zh-TW/reference/tools/xtf/xtfconsolecontrol/xtfconsolecontrol_members)\
[XBOX Tools Framework 原生 API 參考](/zh-TW/reference/tools/xtf/atoc-xtf-native)


## Related topics

- [XtfGetErrorText](/zh-TW/reference/tools/xtf/xtfconsolecontrol/functions/xtfgeterrortext-xtfconsolecontrol-xbox-microsoft-m.md)
- [PartyTextToSpeechProfile::GetIdentifier](/zh-TW/services/playfab/multiplayer/networking/reference/classes/PartyTextToSpeechProfile/methods/partytexttospeechprofile_getidentifier.md)
- [PartyTextToSpeechProfile::GetGender](/zh-TW/services/playfab/multiplayer/networking/reference/classes/PartyTextToSpeechProfile/methods/partytexttospeechprofile_getgender.md)
- [PartyTextToSpeechProfile::GetName](/zh-TW/services/playfab/multiplayer/networking/reference/classes/PartyTextToSpeechProfile/methods/partytexttospeechprofile_getname.md)
- [XtfGetAumid](/zh-TW/reference/tools/xtf/xtfapi/functions/xtfgetaumid-xtfapi-xbox-windows-m.md)
