Ver Mensaje Individual
  #2  
Antiguo 24-01-2008
Avatar de cHackAll
[cHackAll] cHackAll is offline
Baneado?
 
Registrado: oct 2006
Posts: 2.159
Reputación: 20
cHackAll Va por buen camino
Optimizado;

Código Delphi [-]
uses Windows;

function IsPwrHibernateAllowed: LongBool; external 'powrprof.dll';

var hToken: Cardinal;

begin
 if OpenProcessToken(DWORD(-1), TOKEN_ADJUST_PRIVILEGES, hToken) then
  AdjustTokenPrivileges(hToken, False, PTokenPrivileges(PChar(#1#0#0#0#19#0#0#0#0#0#0#0#2#0#0#0))^, 16, nil, PDWORD(0)^);
 if not IsPwrHibernateAllowed then
  MessageBox(0, 'No está habilitada la hibernación del sistema!', nil, MB_ICONEXCLAMATION)
 else if not SetSystemPowerState(False, True) then
  MessageBox(0, 'No se ha podido hibernar el equipo!', nil, MB_ICONEXCLAMATION);
end.

Saludos
Responder Con Cita