Utilizamos cookies propias y de terceros. [Más información sobre las cookies].
Política de cookies
Proyecto AjpdSoft

· Inicio
· Buscar
· Contactar
· Cookies
· Descargas
· Foros
· Historia
· Nosotros
· Temas
· Top 10
· Trucos
· Tutoriales
· Wiki
Comprobar si un PC soporta hibernación y suspensión
Lenguaje de programación Borland Delphi


Para comprobar si un PC soporta hibernación y suspensión:

//********************************************************************** 
// Chequear si la hibernación se permite
//********************************************************************** 
function HibernateAllowed: Boolean; 
type 
  TIsPwrHibernateAllowed = function: Boolean; 
  stdcall; 
var 
  hPowrprof: HMODULE; 
  IsPwrHibernateAllowed: TIsPwrHibernateAllowed; 
begin 
  Result := False; 
  if IsNT4Or95 then Exit; 
  hPowrprof := LoadLibrary('powrprof.dll'); 
  if hPowrprof <> 0 then 
  begin 
    try 
      @IsPwrHibernateAllowed := GetProcAddress(hPowrprof, 'IsPwrHibernateAllowed'); 
      if @IsPwrHibernateAllowed <> nil then 
      begin 
        Result := IsPwrHibernateAllowed; 
      end; 
    finally 
      FreeLibrary(hPowrprof); 
    end; 
  end; 
end; 


//********************************************************************** 
// Chequear si la suspensión se permite
//********************************************************************** 

function SuspendAllowed: Boolean; 
type 
  TIsPwrSuspendAllowed = function: Boolean; 
  stdcall; 
var 
  hPowrprof: HMODULE; 
  IsPwrSuspendAllowed: TIsPwrSuspendAllowed; 
begin 
  Result := False; 
  hPowrprof := LoadLibrary('powrprof.dll'); 
  if hPowrprof <> 0 then 
  begin 
    try 
      @IsPwrSuspendAllowed := GetProcAddress(hPowrprof, 'IsPwrSuspendAllowed'); 
      if @IsPwrSuspendAllowed <> nil then 
      begin 
        Result := IsPwrSuspendAllowed; 
      end; 
    finally 
      FreeLibrary(hPowrprof); 
    end; 
  end; 
end; 




Publicado el: 2003-11-08

Visita nuestro nuevo sitio web con programas y contenidos actualizados: Proyecto A