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

# XGameUiShowErrorDialogAsync

> XGameUiShowErrorDialogAsync

# XGameUiShowErrorDialogAsync

針對指定的錯誤碼，顯示含有服務定義之錯誤字串的錯誤對話方塊 UI。

## 語法

```cpp theme={null}
HRESULT XGameUiShowErrorDialogAsync(  
         XAsyncBlock* async,  
         HRESULT errorCode,  
         const char* context  
)  
```

### 參數

*async*   \_In\_\
類型：[XAsyncBlock\*](https://docs.xbox.com/zh-TW/reference/system/xasync/structs/xasyncblock.md)

傳遞至 [XAsyncRun](https://docs.xbox.com/zh-TW/reference/system/xasync/functions/xasyncrun.md) 之 [XAsyncBlock](https://docs.xbox.com/zh-TW/reference/system/xasync/structs/xasyncblock.md) 的指標。

*errorCode*   \_In\_\
類型：HRESULT

要為其顯示 UI 的錯誤碼。

*context*   \_In\_opt\_\
類型：char\*

要針對此錯誤顯示的服務定義錯誤字串。

### 傳回值

類型：HRESULT

非同步呼叫的 HRESULT 成功或錯誤碼。

## 備註

對話方塊上可能會視情況出現其他按鈕，例如供 XBOX Insider 回報錯誤的「回報問題」按鈕。

當使用者關閉錯誤對話方塊時，非同步作業即完成。

呼叫 UI 會導致您的遊戲進入\_受限模式\_。在受限模式下，您的遊戲位於所呼叫 UI 的背景時，將會獲得較少的系統資源。若要深入了解受限模式及遊戲的其他作業模式，請參閱 [XBOX 遊戲生命週期 (NDA 主題)](https://docs.xbox.com/zh-TW/build/console-features/console-workflows/xbox-game-life-cycle.md)。

## 需求

**標頭：** XGameUI.h

**程式庫：** xgameruntime.lib

**支援的平台：** Windows、Steam Deck、XBOX One 系列主機和 XBOX Series 主機

## 另請參閱

[XGameUI](https://docs.xbox.com/zh-TW/reference/system/xgameui/xgameui_members.md)\
[XGameUIShowErrorDialogResult](https://docs.xbox.com/zh-TW/reference/system/xgameui/functions/xgameuishowerrordialogresult.md)\
[XBOX 遊戲生命週期 (NDA 主題)](https://docs.xbox.com/zh-TW/build/console-features/console-workflows/xbox-game-life-cycle.md)


## Related topics

- [XGameUiShowErrorDialogResult](https://docs.xbox.com/zh-TW/reference/system/xgameui/functions/xgameuishowerrordialogresult.md)
- [XGameUiShowErrorDialogUiCallback](https://docs.xbox.com/zh-TW/reference/system/xgameui/functions/xgameuishowerrordialoguicallback.md)
- [XGameUiSetErrorDialogUiResponse](https://docs.xbox.com/zh-TW/reference/system/xgameui/functions/xgameuiseterrordialoguiresponse.md)
- [XGameUiUiCallbacks](https://docs.xbox.com/zh-TW/reference/system/xgameui/structs/xgameuiuicallbacks.md)
- [XGameUI (API 內容)](https://docs.xbox.com/zh-TW/reference/system/xgameui/xgameui_members.md)
