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

# Constrain

> IXtfApplicationClient::Constrain

Places the app with the specified package moniker into constrained mode.

## Syntax

```cpp theme={null}
public:
HRESULT Constrain(
         LPCWSTR pszPackageMoniker
)  
```

### Parameters

*pszPackageMoniker*\
Type: LPCWSTR

A pointer to the package moniker for the app that is to be put into constrained mode.

### Return value

Type: HRESULT

Returns `S_OK` if successful; otherwise, returns an HRESULT error code.

## Remarks

This function puts the app specified in `pszPackageMoniker` into constrained mode. While in constrained mode, the app has reduced access to reserved system resources. Use the [Unconstrain](https://docs.xbox.com/reference/tools/xtf/xtfapplication/classes/IXtfApplicationClient/methods/unconstrain-ixtfapplicationclient-xtfapplication-xbox-windows-m.md) method to leave constrained mode and return to full mode. For more information about game life cycle states, see [XBOX Game Life Cycle (NDA topic)](https://docs.xbox.com/build/console-features/console-workflows/xbox-game-life-cycle.md).

For more information about how to use XBOX Tools Framework (XTF) to constrain and unconstrain an app for testing, see [Application Management (xbapp.exe) (NDA topic)](https://docs.xbox.com/tools/tools-console/commandlinetools/xbapp.md).

## Requirements

**Header:** xtfapplication.h

**Library:** xtfapplication.lib

**Supported platforms:** Windows (for XBOX console tools)

## See also

[IXtfApplicationClient::Unconstrain](https://docs.xbox.com/reference/tools/xtf/xtfapplication/classes/IXtfApplicationClient/methods/unconstrain-ixtfapplicationclient-xtfapplication-xbox-windows-m.md)\
[IXtfApplicationClient](https://docs.xbox.com/reference/tools/xtf/xtfapplication/classes/IXtfApplicationClient/ixtfapplicationclient-xtfapplication-xbox-microsoft-t.md)\
[XtfApplication](https://docs.xbox.com/reference/tools/xtf/xtfapplication/xtfapplication-xbox-microsoft-n.md)


## Related topics

- [PFPlayerProfileViewConstraints](https://docs.xbox.com/services/playfab/api-references/c/pftypes/structs/pfplayerprofileviewconstraints.md)
- [title_profile_view_constraints_changed](https://docs.xbox.com/services/playfab/api-references/events/PlayerIdentity/title-profile-view-constraints-changed.md)
- [XR-112 Establishing a User and Controller During Initial Activation and Resume](https://docs.xbox.com/publishing/certification/xr/xr-112.md)
- [Using direct peer-to-peer connections](https://docs.xbox.com/services/playfab/multiplayer/networking/concepts-direct-peer-connectivity.md)
- [OS Patch level updates for Windows](https://docs.xbox.com/services/playfab/multiplayer/servers/os-patch-updates.md)
