Ver Mensaje Individual
  #2  
Antiguo 05-12-2007
Avatar de dec
dec dec is offline
Moderador
 
Registrado: dic 2004
Ubicación: Alcobendas, Madrid, España
Posts: 13.112
Reputación: 34
dec Tiene un aura espectaculardec Tiene un aura espectacular
Hola,

Para esto último sí que existe una función "IsUserAnAdmin", pero, sobre la que no encuentro documentación en MSDN, y que parece no estar declarada en Delphi. Sin embargo, puede usarse más o menos así:

Código Delphi [-]
function IsUserAnAdmin(): boolean;
const
  SHELL32 = 'shell32.dll';
  PROCNAME = 'IsUserAnAdmin';
var
  hDll: HMODULE;
  func: function(): bool; stdcall;
begin
  result := false;
  hDll := LoadLibrary(PChar(SHELL32));
  if (hDll <> 0) then begin
    try
      func := GetProcAddress(hDll, PChar(PROCNAME));
      if Assigned(func) then
        result := func();
    finally
      FreeLibrary(hDll);
    end;
  end;
end;

Al menos en Windows XP SP2 funciona bien.
__________________
David Esperalta
www.decsoftutils.com
Responder Con Cita