Code archives/BlitzPlus Gui/Simple System Commands

This code has been declared by its author to be Public Domain code.

Download source code

Simple System Commands by Petron
(Posted 20 years ago)
Simple system commands restart, logoff, and shutdown. The code is short but it does what is needed. Enjoy
window=CreateWindow( "System",0,0,192,56,0,1 )
button=CreateButton( "Turn Off",0,0,64,24,window )
buttona=CreateButton( "Log Off",64,0,64,24,window )
buttonb=CreateButton( "Restart",128,0,64,24,window )
While WaitEvent()<>$803
If EventID()=$401
If EventSource()=button	Then ExecFile("Shutdown.exe -s") 
If EventSource()=buttona Then ExecFile("Shutdown.exe -l")
If EventSource()=buttonb Then ExecFile("Shutdown.exe -r")
EndIf
Wend
End

Comments

Petron
(Posted 20 years ago)
Blitz Plus only

SebHoll
(Posted 20 years ago)
Windows XP only...

ShadowTurtle
(Posted 20 years ago)
SP1 and higher only ...

Petron
(Posted 20 years ago)
My Bad

Starwar
(Posted 20 years ago)
Use shutdown.exe -a to stop the shutdown process
with shutdown.exe -t XX (XX = time in seconds) you can edit the countdowntime. With shutdown.exe -f you can kill applications.

ShadowTurtle
(Posted 20 years ago)
Repeat
  ExecFile("shutdown.exe -f");
Forever


h3h3 :=)

Code Archives Forum