Вниз
Скачать: CL | DM;

2 секунды   Найти похожие ветки 

← →
dan   (2005-06-23 02:31) [0]

Всем привет, у меня вопрос на 2 секунды.
Как выключить комп в XP?
Заранее спасибо.


← →
Kerk ©   (2005-06-23 07:57) [1]

ExitWindowSex

The ExitWindowsEx function either logs off the current user, shuts down the system, or shuts down and restarts the system. It sends the WM_QUERYENDSESSION message to all applications to determine if they can be terminated.


← →
MS-MEN ©   (2005-06-23 09:52) [2]

> Kerk
Не забывай надо ещё иметь привилигий DEBUG  )

procedure NTShutdown;
var
 TokenHandle: Cardinal;
 RetLength: Cardinal;
 TP: TTokenPrivileges;
begin
 OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES
   or TOKEN_QUERY, TokenHandle);
 if LookupPrivilegeValue(nil, "SeShutdownPrivilege",
   TP.Privileges[0].Luid) then
 begin
   TP.PrivilegeCount := 1;
   TP.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED;
   RetLength := 0;
   if AdjustTokenPrivileges(TokenHandle, FALSE, TP, 0, nil, RetLength) then
   begin
     if not SetProcessShutdownParameters($4FF, SHUTDOWN_NORETRY) then
     begin
       MessageBox(0, "Shutdown failed", nil, MB_OK or MB_ICONSTOP);
     end
     else
     begin
       ExitWindowsEx(EWX_FORCE or EWX_SHUTDOWN, 0);
     end;
     exit;
   end;
 end;
 MessageBox(0, "Access denied", nil, MB_OK or MB_ICONSTOP);
end;


← →
Kerk ©   (2005-06-23 09:57) [3]

To shut down or restart the system, the calling process must use the AdjustTokenPrivileges function to enable the SE_SHUTDOWN_NAME privilege.


← →
MS-MEN ©   (2005-06-23 10:03) [4]

:)



Страницы: 1 вся ветка

Скачать: CL | DM;



Память: 0.45 MB
Время: 0.028 c
1-1122448657
wolf2541
2005-07-27 11:17
2005.08.14
проблема с cross-tab в fast report 2.5


1-1121922698
Mefodiy
2005-07-21 09:11
2005.08.14
Как определить "графическое быстрдействия" компьютера


14-1121919393
SergP
2005-07-21 08:16
2005.08.14
Нужен сервер ICQ под WINDOWS


3-1120470697
Zhekson
2005-07-04 13:51
2005.08.14
Распечатка DBGrid_a


5-1092908728
Alexander S.
2004-08-19 13:45
2005.08.14
Кто как компоненты компилирует




   Наверх