如何完完全全关闭windows2000?
wzs 2001-11-27 04:49:33 以下是我抄来的一段关闭win2000的程序,虽然能关,但我觉得美中不足,在程序执行到最后就会出现"您可以安全关闭计算机了"我还得按POWER才能把电源关了,这种是机箱不是ATX的才出现的问题,但我这台是ATX的啊,不知哪位高人会把真正的电源也关闭?
procedure ShutDown;
const
SE_SHUTDOWN_NAME = 'SeShutdownPrivilege';
var hToken : THandle;
tkp : TTokenPrivileges;
tkpo : TTokenPrivileges;
zero : DWORD;
begin
zero := 0;
if not OpenProcessToken( GetCurrentProcess(), TOKEN_QUERY, hToken) then
begin
MessageBox( 0, 'Exit Error', 'OpenProcessToken() Failed', MB_OK );
Exit;
end;
if not LookupPrivilegeValue( nil, 'SeShutdownPrivilege' , tkp.Privileges[ 0 ].Luid ) then
begin
MessageBox( 0, 'Exit Error', 'LookupPrivilegeValue() Failed', MB_OK );
Exit;
end;
if not LookupPrivilegeValue( nil, 'SeShutdownPrivilege' , tkp.Privileges[ 0 ].Luid ) then
begin
MessageBox( 0, 'Exit Error', 'LookupPrivilegeValue() Failed', MB_OK );
Exit;
end;
tkp.PrivilegeCount := 1;
tkp.Privileges[ 0 ].Attributes := SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges( hToken, False, tkp, SizeOf( TTokenPrivileges ), tkpo, zero );
if Boolean( GetLastError() ) then
begin
MessageBox( 0, 'Exit Error', 'AdjustTokenPrivileges() Failed', MB_OK );
Exit;
end;
ExitWindowsEx(EWX_SHUTDOWN,0);
end;