I had the same problem with needing to unplug my cinema display from my laptop... the image CGImageRef image was too large... This fixes it: CGImageRef image = CGAutorelease(CGWindowListCreateImage(
*(CGRect *)&displayBounds,
kCGWindowListOptionOnScreenOnly,
kCGNullWindowID,
kCGWindowImageDefault));
by George Dick — Dec 17
CGImageRef image = CGAutorelease(CGWindowListCreateImage( *(CGRect *)&displayBounds, kCGWindowListOptionOnScreenOnly, kCGNullWindowID, kCGWindowImageDefault));