Shutdown() 关机

{
shutdown -s -t 0 立即关闭计算机
shutdown -l 立即注销计算机
shutdown -r -t 0 立即重启计算机
shutdown -a 取消关闭计算机
}
 
{在uses中引入 ShellAPI}
uses ShellAPI;

{关机相关} 
//调用//  Shutdown(0); 
procedure Shutdown(sType:integer); 
begin 
   case  sType of 
     0: ShellExecute(Application.Handle, 'open', 'shutdown.exe', '-s -t 0', 0, SW_SHOWNORMAL);    {关闭计算机} 
     1: ShellExecute(Application.Handle, 'open', 'shutdown.exe', '-l', 0, SW_SHOWNORMAL);         {注销计算机} 
     2: ShellExecute(Application.Handle, 'open', 'shutdown.exe', '-r -t 0', 0, SW_SHOWNORMAL);    {重启计算机} 
     3: ShellExecute(Application.Handle, 'open', 'shutdown.exe', '-a', 0, SW_SHOWNORMAL);         {取消关闭计算机} 
   end
end;





你可能感兴趣的:(shutdown)