quinta-feira, 11 de setembro de 2008

Retorna o Nome do Usuário logado na rede

//Declare Registry na clausula uses da unit

function LogUser : String;

var Registro: TRegistry;
begin
Registro := TRegistry.Create;
Registro.RootKey := HKEY_LOCAL_MACHINE;
if Registro.OpenKey('Network\Logon', false) then
result := Registro.ReadString('username');
Registro.Free;
end;

Nenhum comentário: