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

# XPackageIsPackagedProcess

> XPackageIsPackagedProcess

# XPackageIsPackagedProcess

傳回布林值，指出目前的處理程序是否具有安裝身分識別。

## 語法

```cpp theme={null}
bool XPackageIsPackagedProcess(  
)  
```

### 參數

無。

### 傳回值

類型：bool

如果處理程序具有安裝身分識別，則傳回 true。否則傳回 false。

## 備註

您可以判斷遊戲是否已完全安裝。下列程式碼範例適用於已封裝的 MSICVC 遊戲以及鬆散部署。如果遊戲已完全安裝，傳回值 `bool *isInstalled` 會設定為 true。

```cpp theme={null}
HRESULT IsPackageCompletelyInstalled(bool *isInstalled)
{
    if (XPackageIsPackagedProcess())
    {
        char id[XPACKAGE_IDENTIFIER_MAX_LENGTH];
        HRESULT hr = XPackageGetCurrentProcessPackageIdentifier(_countof(id), id);
        if (FAILED(hr)) return hr;

        XPackageInstallationMonitorHandle monitor;
        hr = XPackageCreateInstallationMonitor(id, 0, nullptr, 0, nullptr, &monitor);
        if (FAILED(hr)) return hr;

        XPackageInstallationProgress progress;
        XPackageGetInstallationProgress(monitor, &progress);

        *isInstalled = (progress.completed);

        XPackageCloseInstallationMonitorHandle(monitor);
    }
    else
    {
        *isInstalled = true;
    }

    return S_OK;
}
```

## 需求

**標頭：** XPackage.h

**程式庫：** xgameruntime.lib

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

## 概念文件

* [將遊戲部署到 XBOX 開發套件](https://docs.xbox.com/zh-TW/home/setup-install/concepts/deployment.md)

## 另請參閱

[封裝概觀](https://docs.xbox.com/zh-TW/build/core-features/common/packaging/overviews/packaging.md)\
[串流安裝和 Intelligent Delivery](https://docs.xbox.com/zh-TW/build/core-features/common/packaging/overviews/streaming_install-intelligent_delivery.md)\
[XPackage](https://docs.xbox.com/zh-TW/reference/system/xpackage/xpackage_members.md)


## Related topics

- [XPackage (API 內容)](https://docs.xbox.com/zh-TW/reference/system/xpackage/xpackage_members.md)
- [在 Unity 專案中使用 GDK API 的 C# 包裝函式](https://docs.xbox.com/zh-TW/build/gdk-and-engines/unity/unity-api-wrappers.md)
- [XPackageGetCurrentProcessPackageIdentifier](https://docs.xbox.com/zh-TW/reference/system/xpackage/functions/xpackagegetcurrentprocesspackageidentifier.md)
- [檢查更新](https://docs.xbox.com/zh-TW/publishing/xstore-commerce/xstore-checking-updates.md)
- [管理可下載內容 (DLC) 並授權](https://docs.xbox.com/zh-TW/publishing/xstore-commerce/xstore-dlc.md)
