System Restart or Shutdown from Mac QuickBASIC Program (32264)






This article was previously published under Q32264

SUMMARY

The program below allows you to restart or shut down the Macintosh from within a QuickBASIC program. For the program to work, the System file must be Version 4.10 or later. (To obtain the version number, select the System file and choose Get Info from the File menu.)

Before executing the following portion of code, it is very important to be sure all files and resources have been closed. If files and resources are left open when the computer is restarted, the files may be corrupted.
DIM restart%(2), ShutDown%(2)
setarray restart%(0),&H3F3C,&H2,&HA895
setarray ShutDown%(0),&H3F3C,&H1,&HA895
input "Enter 1 for Restartm 2 for Shut Down",i
if i = 1 then rs = VARPTR(restart%(0))  : CALL rs
if i = 2 then sd = VARPTR(ShutDown%(0))  : CALL sd

Modification Type: Minor Last Reviewed: 1/9/2003
Keywords: KB32264