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

# CGEventCreateData

Returns a flattened data representation of a Quartz event.

```
extern CFDataRefCGEventCreateData(CFAllocatorRef allocator, CGEventRef event);
```

## Parameters

`allocator`

The allocator to use to allocate memory for the data object. To use the current default allocator, pass `NULL` or `kCFAllocatorDefault`.

`event`

The event to flatten.

## Return Value

The flattened data representation of the event, or `NULL` if the `event` parameter is invalid. When you no longer need the data object, you should release it using the function `CFRelease`.

## Discussion

You can use this function to flatten an event for network transport to another system.

---

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)