Ver Mensaje Individual
  #1  
Antiguo 30-06-2006
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - España
Posts: 18.275
Reputación: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
¿Cómo puedo saber el nombre del equipo?

Con esta pequeña función...

Código Delphi [-]
function ComputerName: string;
var
  Buffer: array[ 0..MAX_COMPUTERNAME_LENGTH ] of Char;
  MaxSize: Integer;
begin
  MaxSize := SizeOf( Buffer );
  if not GetComputerName( @Buffer, MaxSize ) then
    raise Exception.Create( 'No puedo determinar el nombre de la máquina' );
  Result := StrPas( @Buffer );
end;

Para probarla utiliza éste código:

Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
begin
  Caption := ComputerName
end;
Responder Con Cita