I need to be able to implement methods to prevent these from happening:
- Shutdown
- Restart
- Logoff
- Sleep
On a Mac, I am using Xcode but can't seem to figure out the code to perform these actions.
开发者_如何学运维Can anyone help me out here?
I found this : http://developer.apple.com/library/mac/#qa/qa1134/_index.html
but I can't seem to understand how to block the system events when they are triggered.
Thanks
In Carbon's Application Manager, there's the SetSystemUIMode
API which lets you control (disable) things like force-quit, the power-key window etc. It's intended for kiosk style applications and described in this tech note.
Disabling sleep, screen-saver, etc. is done by periodically calling UpdateSystemActivity
. See this tech Q&A.
The simple and most effective way to prevent Apple OSX to sleep is the Terminal command:
$ pmset noidle Preventing idle sleep (^C to exit)...
The only annoying thing maybe the user self has to end this manually by issuing a 'Control-C'.
精彩评论