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

# XPackageUpdateInstallationMonitor

> XPackageUpdateInstallationMonitor

# XPackageUpdateInstallationMonitor

重新整理從 [XPackageGetInstallationProgress](/zh-TW/reference/system/xpackage/functions/xpackagegetinstallationprogress) 傳回的進度。

## 語法

```cpp theme={null}
bool XPackageUpdateInstallationMonitor(  
         XPackageInstallationMonitorHandle installationMonitor  
)  
```

### 參數

*installationMonitor*   \_In\_\
類型：XPackageInstallationMonitorHandle

要更新之安裝監視器的控制代碼。

### 傳回值

類型：bool

如果進度快照的任何層面已變更，則傳回 true。否則傳回 false。

## 備註

<Note>在時間敏感的執行緒上呼叫此函式並不安全。如需詳細資訊，請參閱[時間敏感的執行緒](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)。</Note>

可以呼叫 **XPackageUpdateInstallationMonitor** 來重新整理從 [XPackageGetInstallationProgress](/zh-TW/reference/system/xpackage/functions/xpackagegetinstallationprogress) 傳回的進度。如果安裝監視器的重新整理頻率不是零，則會依照重新整理頻率從計時器執行緒自動呼叫此 API。若要控制由哪個執行緒更新進度，請將頻率設定為零，並自行呼叫此 API。如果進度快照的任何層面已變更，**XPackageUpdateInstallationMonitor** 會傳回 true。

以下範例使用 **XPackageUpdateInstallationMonitor** 手動輪詢安裝監視器，以判斷遊戲的安裝是否已完成。安裝完成後，此程式碼會關閉監視器控制代碼。

```cpp theme={null}
bool CheckIfInstalled(XPackageInstallationMonitorHandle monitor)
{
    XPackageInstallationProgress progress;
    XPackageGetInstallationProgress(monitor, &progress);

    if (!progress.completed && XPackageUpdateInstallationMonitor(monitor))
    {
        XPackageGetInstallationProgress(monitor, &progress);
    }

    if (progress.completed)
    {
        XPackageCloseInstallationMonitorHandle(monitor);
    }

    return progress.completed;
}
```

## 需求

**標頭：** XPackage.h

**程式庫：** xgameruntime.lib

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

## 概念文件

* [時間敏感的執行緒](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## 另請參閱

[XPackage](/zh-TW/reference/system/xpackage/xpackage_members)\
[串流安裝和 Intelligent Delivery](/zh-TW/build/core-features/common/packaging/overviews/streaming_install-intelligent_delivery)\
[XPackageGetInstallationProgress](/zh-TW/reference/system/xpackage/functions/xpackagegetinstallationprogress)


## Related topics

- [XPackageUpdateInstallationMonitor](/reference/system/xpackage/functions/xpackageupdateinstallationmonitor.md)
- [XPackage](/reference/system/xpackage/xpackage_members.md)
- [XPackageCreateInstallationMonitor](/reference/system/xpackage/functions/xpackagecreateinstallationmonitor.md)
- [XPackageCloseInstallationMonitorHandle](/reference/system/xpackage/functions/xpackagecloseinstallationmonitorhandle.md)
