Ver Mensaje Individual
  #8  
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
Cita:
Empezado por dec Ver Mensaje
Yo utilizo en cierto proyecto una función similar a esta...
han usado mi truco y le han aumentado "cosas"...

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.

PD: tenemos que usar más la sección de trucos.

Saludos
Responder Con Cita