<!--
{
  "availability" : [
    "macCatalyst: 13.1.0 -",
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreGraphics",
  "identifier" : "/documentation/CoreGraphics/CGDisplayCapture(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Graphics"
    ],
    "preciseIdentifier" : "c:@F@CGDisplayCapture"
  },
  "title" : "CGDisplayCapture(_:)"
}
-->

# CGDisplayCapture(_:)

Obtains exclusive use of a display, preventing other applications and system services from using the display or changing its configuration.

```
func CGDisplayCapture(_ display: CGDirectDisplayID) -> CGError
```

## Parameters

`display`

The identifier of the display to capture.

## Return Value

A Core Graphics result code. To interpret the result code, see [`CGError`](/documentation/CoreGraphics/CGError).

## Discussion

When an application captures a display, Quartz doesn’t allow other applications and system services to use the display or change its configuration.

If hardware or software mirroring is in effect, the easiest way to capture the primary display and all mirrored displays is to use the function [`CGCaptureAllDisplays()`](/documentation/CoreGraphics/CGCaptureAllDisplays()). In case of software mirroring, applications that draw directly to the display must make sure to draw the same content to all displays in the mirror set.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)