![]() |
![]() |
![]() |
![]() |
![]() |
FTP | ![]() |
![]() |
CCD | ![]() |
![]() |
Buscar | ![]() |
![]() |
Trucos | ![]() |
![]() |
Trabajo | ![]() |
![]() |
Foros | ![]() |
|
Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
![]() |
|
Herramientas | Buscar en Tema | Desplegado |
|
#1
|
|||
|
|||
urge. apagar windows XP
Hola nuevamente.
Ya he escrito anteriormente respecto a este tema. y alguien, no recuerdo el nombre, me comentó que mirase én "trucomania". de ahi saque esto: ExitWindowsEx(EWX_SHUTDOWN,0); ExitWindowsEx(EWX_FORCE,0); ExitWindowsEx(EWX_LOGOFF,0); ExitWindowsEx(EWX_POWEROFF,0); ExitWindowsEx(EWX_REBOOT,0); que funciona perfectamente para win 98 y me, pero para XP, nada de nada. a alguien se le ocurre algo? |
#2
|
||||
|
||||
Checa esto:
function TForm1.MyExitWindows(RebootParam: Longword): Boolean; var TTokenHd: THandle; TTokenPvg: TTokenPrivileges; cbtpPrevious: DWORD; rTTokenPvg: TTokenPrivileges; pcbtpPreviousRequired: DWORD; tpResult: Boolean; const SE_SHUTDOWN_NAME = 'SeShutdownPrivilege'; begin if Win32Platform = VER_PLATFORM_WIN32_NT then begin tpResult := OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES or TOKEN_QUERY, TTokenHd); if tpResult then begin tpResult := LookupPrivilegeValue(nil, SE_SHUTDOWN_NAME, TTokenPvg.Privileges[0].Luid); TTokenPvg.PrivilegeCount := 1; TTokenPvg.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED; cbtpPrevious := SizeOf(rTTokenPvg); pcbtpPreviousRequired := 0; if tpResult then Windows.AdjustTokenPrivileges(TTokenHd, False, TTokenPvg, cbtpPrevious, rTTokenPvg, pcbtpPreviousRequired); end; end; Result := ExitWindowsEx(RebootParam, 0); end; Se usa: procedure TForm1.Button1Click(Sender: TObject); begin MyExitWindows(EWX_POWEROFF or EWX_FORCE); end; Espero te ayude en algo.. Saludos. Última edición por NickName fecha: 29-08-2003 a las 19:50:15. |
#3
|
|||
|
|||
hola nuevamente
muchas gracias por tu ayuda. en Windows Xp funciona perfectamente. gracias nuevamente |
#4
|
|||
|
|||
A menudo lo podía hacer cuando empezaba a programar, desgraciadamente no guardé las rutinas
![]() |
![]() |
|
|
![]() |
|