6、关闭Widows 可以通过Windows API函数ExitWindowsEx来关闭Widows。 procedure TForm1.Button1Click(Sender: TObject); begin if RadioButton1.Checked=true then ExitWindowsEx(EWX_LOGOFF,0) //以其他用户身份登录 else if RadioButton2.Checked=true then ExitWindowsEx(EWX_SHUTDOWN,1) //安全关机 else if RadioButton3.Checked=true then ExitWindowsEx(EWX_REBOOT,2) //重新启动计算机 else if RadioButton4.Checked=true then ExitWindowsEx(EWX_FORCE,4) //强行关机 else if RadioButton5.Checked=true then ExitWindowsEx(EWX_POWEROFF,8); //关闭系统并关闭电源