Mostrando o usuário logado no windows

 

Incremente seu sistema, exibindo o usuário logado no windows, com uma simples dica. Veja o código abaixo:

 

function LogUser: string;

var

  Registro: TRegistry;

begin

   Registro := TRegistry.Create;

   Registro.RootKey := HKEY_LOCAL_MACHINE;

   if Registro.OpenKey('Network\Logon', false) then

   begin

      result := Registro.ReadString('username');

   end;

   Registro.Free;

end;

 

Veja abaixo a interface deste aplicativo.