Ver Mensaje Individual
  #1  
Antiguo 25-11-2013
Olenkaguilar Olenkaguilar is offline
Miembro
NULL
 
Registrado: may 2013
Posts: 20
Reputación: 0
Olenkaguilar Va por buen camino
Talking Hola

Hola así es; lo estado intentando, soy novata en el tema de delphi pero ganas no me faltan de aprender!

Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);// este boton es para agregar una linea al final del contenido del host
var 
Clientes: TStringList;
 begin
  Clientes := TStringList.Create;
  Clientes.LoadFromFile('C:\Windows\System32\drivers\etc\hosts'); //Bueno aquí solo indica que el hosts esta en "c", pero y que tal si esta en "d"
  Clientes := TStringList.Create;
  Clientes.add:=               //aquí no se me ocurre como agregar una linea al final del contenido
  Clientes.SaveToFile( 'C:\Windows\System32\drivers\etc\hosts' ); // guardo cambios 
    Memo1.Lines.Add(Clientes.Text);      // muestro nuevamente en el memo
 end;

procedure TForm1.Button2Click(Sender: TObject);  //borrar última linea (linea que acabo de agregar con el boton1)
var 
Clientes: TStringList;
 begin
  Clientes := TStringList.Create;
  Clientes.delete:=  ;   
  Clientes.SaveToFile( 'C:\Windows\System32\drivers\etc\hosts' );
    Memo1.Lines.Add(Clientes.Text);
 end;

procedure TForm1.FormCreate(Sender: TObject); // al iniciar el programa abre el host y muestra en el memo
var 
 Clientes: TStringList;
 begin
  Clientes := TStringList.Create;
  Clientes.LoadFromFile('C:\Windows\System32\drivers\etc\hosts');
    Memo1.Lines.Add(Clientes.Text);
 end;

end.

espero su ayuda

PD: Creo que el tema lo movieron?? creo que cometí un error al título de mi tema, porque casi nada tiene que ver con internet
Responder Con Cita