Ver Mensaje Individual
  #4  
Antiguo 14-10-2004
Avatar de DarkByte
DarkByte DarkByte is offline
Miembro
 
Registrado: sep 2003
Ubicación: Desconocido
Posts: 1.322
Reputación: 22
DarkByte Va por buen camino
IcebergDelphi, por favor, intenta usar la etiqueta [ Delphi ] cada vez que vayas a escribir código... esta vez lo hago yo para que veas como queda

Código Delphi [-]
procedure TFrmPruebaServer.MyTimerTimer(Sender: TObject);
begin
 EdtFinal.Text:=TimeToStr(Time());
end;

procedure TFrmPruebaServer.BtnIniciarClick(Sender: TObject);//Inicia el conteo//
begin
 MyMainServer.Connect;// Componente Indy
      EdtIni.Text:=TimeToStr(Time());
 LblTotal.Caption:='';
MyTimer.Enabled:=True;//Timer
end;

procedure TFrmPruebaServer.BtnTerminarClick(Sender: TObject);//termnina el conteo//
Var
Resultado:TDateTime;
begin
Resultado:=StrToTime(EdtFinal.Text)-StrToTime(EdtIni.Text);
   MyTimer.Enabled:=False;
     MyMainServer.Disconnect;
LblTotal.Caption:='El Total consumido es:' + TimeToStr(Resultado);
end;
end.

//Y el las propiedades del componente Indy tengo lo siguiente:
Host:=Initec08 //Maquina a la cual me comunicare
Port:=6711

Y por ultimo:

/**************************************************
Codigo de la aplicacion que estara en las maquinas
*************************************************
Tengo un formulario con un componente Indy llamado TidTCPServer

Que al crearse el form se activa
*/

procedure TFrmCliente.FormCreate(Sender: TObject);
begin
MyTcpClient.Active:=True;//Componente cuando se activa
end;


procedure TFrmCliente.MyTcpClientConnect(AThread: TIdPeerThread);
//Codigo del componente al recibir comunicacion, el formulario se oculta y dejara trabajar al usuario
begin
  FrmCliente.Hide;
end;

procedure TFrmCliente.MyTcpClientDisconnect(AThread: TIdPeerThread);
// Al terminar la comunicacion o desconectarse, el fomulario aparecera y bloquera la maquina.
begin
  FrmCliente.Show;
end;

end.
__________________
:)
Responder Con Cita