This isn't as easy as it used to be. Once-upon-a-time you could call Interrupt zero, creating a processor exception, shutting down the machine. With Win9x, it just crashes the machine.
You might try...
[tt]
WinDir$ = ENVIRON$("windir"
KillWin$ = WinDir$ + "\Rundll.exe User.exe,ExitWindows"
SHELL KillWin$
[/tt]
...but this might be more work than what it is worth. Windows doesn't like to shut down DOS apps automatically and it is likely to prompt you to click okay to close your program and Windows or click Cancel to continue working.
Somebody post here if you know an easy way to do this using BASIC (with or without calls to the ROM BIOS).
Alt255,
I think your way is the best way for Winxx machines.
None of the low-level techniques work on the new Windows 32 environment. The most they do is close the DOS box. In the WinNT/2K environments, shutting down the computer may be disabled for a given account. In that case, there's no way to do it, as far as I know.
boot1:
DEF SEG = &H40
POKE &H473, 12 '0000 for cold boot
POKE &H472, 34
DEF SEG = -1: '-1==&HFFFF
CALL ABSOLUTE(0)
END
boot2:
OUT 100, 254
boot3:
SHELL "START"
boot4:
'int 19h using CALL INTERRUPT(&h19,regs,regs)
As an aside, using a CALL to FFFF:0000 or OUT &H64, &H92/&HFE will cause windows to kill the DOS box, so you could use the RunDLL32 method followed by the old-fashioned method to work -- at least to some extent -- around Windows asking whether you want to kill the DOS window or not.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.