[futurebasic] Re: [FB] [FB3] [Release 7.0] Shutdown

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : September 2002 : Group Archive : Group : All Groups

From: Brian Stevens<brilor@...>
Date: Fri, 20 Sep 2002 21:25:52 -0700
>I need to be able to shutdown the computer when a button I have in my program
>is clicked, how do I do that?   This is in OSX.   I'd also like to be able to
>restart the computer as well.

Brian,

Ken S. once posted the following untested(by me) code using appleevents:


local fn doShutdown
long if ( system( _sysVers ) >= 1000 ) // OS X 10.0.0 or higher
sendAppleEvent _kCoreEventClass, _"shut", _nil, _nil, "loginwindow"
xelse
sendAppleEvent _"fndr", _"shut", _nil, _nil, "Finder"
end if
end fn

fn doShutdown
==============================

There are some toolbox calls which I don't find in the latest 
headers. Those definitions are:

toolbox ShutDwnPower() `0x3F3C, 0x0001, 0xA895
toolbox ShutDwnStart() `0x3F3C, 0x0002, 0xA895
toolbox ShutDwnInstall(long shutDownProcAddr,short flags) `0x3F3C, 
0x0003,0xA895
toolbox ShutDwnRemove(long shutDownProcAddr) `0x3F3C, 0x0004, 0xA895

HTH----Brian