Cita:
Empezado por dec
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