Restart / Shutdown from Cocoa
Restart / Shutdown from Cocoa
- Subject: Restart / Shutdown from Cocoa
- From: Marc Laffitte <email@hidden>
- Date: Wed, 7 Nov 2001 18:08:41 +0100
Hi!
I need to programatically restart the computer.
Under Mac OS 9 and prior, I could send a kAERestart Apple event to the
Finder. However this has no effect under Mac OS X.
Now, the documentations in "Inside Mac OS X: System Overview says":
- The Finder or an other application has to send a Quit All Apple event
(kAEQuitAll) to loginwindow
- When loginwindow returns noErr, the process sends an Apple event
requesting logout, restart, or shutdown.
But I found no code snippet for this.
Well, to send an Apple event, a couple of other information pieces are
needed. What I miss is:
- the signature to use (is it 'lgnw' ?)
- the AEEventClass to use with AECreateAppleEvent ( kAEFinderEvents,
kCoreEventClass, ... ?)
Furthermore, what does "When loginwindow returns noErr" mean? Do I have
to inspect a replied Apple Event?
Thanks for any help,
Marc