Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > API de Windows
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

 
 
Herramientas Buscar en Tema Desplegado
  #7  
Antiguo 24-01-2008
Avatar de dec
dec dec is offline
Moderador
 
Registrado: dic 2004
Ubicación: Alcobendas, Madrid, España
Posts: 13.142
Poder: 36
dec Tiene un aura espectaculardec Tiene un aura espectacular
Hola,

Yo utilizo en cierto proyecto una función similar a esta:

Código Delphi [-]
function SystemCanHibernate(): boolean;
resourcestring
  rsDll = 'powrprof.dll';
  rsFunc = 'IsPwrHibernateAllowed';
type
  TFunc = function: boolean; stdcall;
var
  func: TFunc;
  hDll: THandle;
begin
  result := false;
  hDll := LoadLibrary(PChar(rsDll));
  if (hDll <> 0) then
  try
    @func := GetProcAddress(hDll, PChar(rsFunc));
    result := Assigned(func) and func();
  finally
    FreeLibrary(hDll);
  end;
end;

Esta otra función serviría para averiguar si el sistema puede suspenderse:

Código Delphi [-]
function SystemCanSuspend(): boolean;
resourcestring
  rsDll = 'powrprof.dll';
  rsFunc = 'IsPwrSuspendAllowed';
type
  TFunc = function: boolean; stdcall;
var
  func: TFunc;
  hDll: THandle;
begin
  result := false;
  hDll := LoadLibrary(PChar(rsDll));
  if (hDll <> 0) then
  try
    @func := GetProcAddress(hDll, PChar(rsFunc));
    result := Assigned(func) and func();
  finally
    FreeLibrary(hDll);
  end;
end;
__________________
David Esperalta
www.decsoftutils.com
Responder Con Cita
 


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Suspender e hibernar el pc jorgegetafe Varios 14 02-11-2007 16:15:52
Dilema marcoszorrilla La Taberna 9 21-09-2007 16:23:20
Delphi - VB : Gran Dilema jorge_mosquera OOP 1 20-03-2007 16:13:58
El gran dilema de la impresión hgiacobone Impresión 5 19-04-2005 09:28:06
Dilema Matrimonial guillotmarc Humor 4 17-05-2003 00:02:22


La franja horaria es GMT +2. Ahora son las 12:13:13.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi