Ver Mensaje Individual
  #3  
Antiguo 02-08-2010
Avatar de richy08
richy08 richy08 is offline
Miembro
 
Registrado: may 2007
Ubicación: Bucerias, Nayarit Mexico
Posts: 529
Reputación: 17
richy08 Va por buen camino
no al llegar ahi el componnete ya fue creado, el problema es en esta linea
AThread.Data := @MisComponentes; segun lo que me explico un compañero del foro lo que hace es meter la direccion de memoria a la variable data del hilo pero en en evento Evecute del tcpserver trato de recuperar dichos valores pero no entiendo por que no lo recupera

Código Delphi [-]
procedure TFrm_Interfaces.ServerExecute(AThread: TIdPeerThread);
var
  ActClient, RecClient: PClient;                                                                              
  CommBlock, NewCommBlock: TCommBlock;
  RecThread: TIdPeerThread;
  i, seleccion: Integer;
  MisComponentes:tmisComponentes;
begin
  if not AThread.Terminated and AThread.Connection.Connected then
  begin
    AThread.Connection.ReadBuffer (CommBlock, SizeOf (CommBlock));
    ActClient := PClient(AThread.Data);
    ActClient.LastAction := Now;  // update the time of last action

    MisComponentes :=  tmisComponentes(AThread.Data);//trato de recuperar las conexiones creadas
    
    //queryMssql
    MisComponentes.Query.Close;
    MisComponentes.Query.parameters.ParamByName('acode').Value:=CommBlock.acode;
    MisComponentes.Query.open;
    //queryMssql

    //ejecuta abrir y cerrar lineas
     i:=0;
     seleccion:=MisComponentes.Query.RecordCount;
     MisComponentes.Query.First;
     While ido
     begin
        MisComponentes.Query1.Close;
        MisComponentes.Query1.ParamByName('allowcalls').Value:=CommBlock.estado;
        MisComponentes.Query1.ParamByName('ldesc').Value:=CommBlock.nombre;
        MisComponentes.Query1.ParamByName('code').Value:=MisComponentes.Query1.fieldbyname('idext').Value;
        MisComponentes.Query1.ExecSQL;
        i:=i+1;
        MisComponentes.Query.Next;
     end;
    //ejecuta abrir y cerrar lineas

    Protocol.Lines.Add (TimeToStr(Time)+' The process for '+CommBlock.MyUserName+' was done ');// # Confirm'+inttostr(CommBlock.nconf));
    NewCommBlock.Command := 'DIALOG';       // the message should popup on the client's screen
    NewCommBlock.MyUserName := '[PBX Server]';  // the server's username
    NewCommBlock.Msg := 'The process was done  ';  // the message to show
    NewCommBlock.ReceiverName := '[return-to-sender]'; // unnecessary
    AThread.Connection.WriteBuffer (NewCommBlock, SizeOf (NewCommBlock), true);  // and there it goes...
  end;
end;
Responder Con Cita