Search code examples
cocoaxcodemacosmacos-carbon

Sleep Display Cocoa/Carbon


I'm trying to make my application sleep the screen.

I've looked into pmset with no success and I even tried IOHIDPostEvent. I can get IOHIDPostEvent to press the Eject key but setting the shift and control flags has no effect.

Any help is greatly appreciated.


Solution

  • Don't believe there is a public API yet (please file a bug), but some code is here.