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

# XPackageRegisterPackageInstalled

> XPackageRegisterPackageInstalled

# XPackageRegisterPackageInstalled

Registers a callback to be called when an installation is completed.

## Syntax

```cpp theme={null}
HRESULT XPackageRegisterPackageInstalled(  
         XTaskQueueHandle queue,  
         void* context,  
         XPackageInstalledCallback* callback,  
         XTaskQueueRegistrationToken* token  
)  
```

### Parameters

*queue*   \_In\_\
Type: XTaskQueueHandle

The asynchronous queue on which the callback is to run.

*context*   \_In\_opt\_\
Type: void\*

Context to be passed to the callback.

*callback*   \_In\_\
Type: XPackageInstalledCallback\*

User-defined callback to be called when an installation is completed.

*token*   \_Out\_\
Type: [XTaskQueueRegistrationToken\*](/reference/system/xtaskqueue/structs/xtaskqueueregistrationtoken)

On return, contains a token that identifies the callback that can be used to unregister the callback with [XPackageUnregisterPackageInstalled](/reference/system/xpackage/functions/xpackageunregisterpackageinstalled).

### Return value

Type: HRESULT

HRESULT success or error code.

## Remarks

PackageInstalled notifications can be used to determine when a new package is fully installed.

Both the [XPackageEnumeratePackages](/reference/system/xpackage/functions/xpackageenumeratepackages) API and [XPackageRegisterPackageInstalled](/reference/system/xpackage/functions/xpackageregisterpackageinstalled) API provide details about an installation, through an **XPackageDetails** structure. If the package is installing, the **installing** property is set to true and you can create an installation monitor, to let the package's identifier monitor the progress of installation.

There are no generic installation queue notifications; the intent is to use [XPackageEnumeratePackages](/reference/system/xpackage/functions/xpackageenumeratepackages) to show and track items in flight, and to use **PackageInstalled** to announce the presence of new DLC. Nor is there an API to stop, start, or cancel an installation. From a game's perspective, the installation should take care of itself. Errors are automatically retried and invisible to the game.

In the following example, **XPackageRegisterPackageInstalled** is used to print a message when a new DLC package is installed:

```cpp theme={null}
void CALLBACK NewPackageAdded(void* /* context */, const XPackageDetails* details)
{
    if (details->kind == XPackageKind::Content)
    {
        printf("Package added: %s\n", details->displayName);
    }
}

HRESULT ListenForNewDlc(XTaskQueueHandle queue, XTaskQueueRegistrationToken* token)
{
    HRESULT hr = XPackageRegisterPackageInstalled(queue, nullptr, NewPackageAdded, token);
    return hr;
}

void StopListeningForDlc(XTaskQueueRegistrationToken token)
{
    XPackageUnregisterPackageInstalled(token, false);
}
```

## Requirements

**Header:** XPackage.h

**Library:** xgameruntime.lib

**Supported platforms:** Windows, XBOX One family consoles and XBOX Series consoles

## Conceptual documentation

* [Streaming installation: status](/build/core-features/common/packaging/packaging-installstatus)

## See also

[XPackage](/reference/system/xpackage/xpackage_members)


## Related topics

- [XPackageUnregisterPackageInstalled](/reference/system/xpackage/functions/xpackageunregisterpackageinstalled.md)
- [XPackageInstalledCallback](/reference/system/xpackage/functions/xpackageinstalledcallback.md)
- [XPackageEnumerationCallback](/reference/system/xpackage/functions/xpackageenumerationcallback.md)
- [XPackage](/reference/system/xpackage/xpackage_members.md)
- [Streaming installation: status](/build/core-features/common/packaging/packaging-installstatus.md)
