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;
MisComponentes := tmisComponentes(AThread.Data);
MisComponentes.Query.Close;
MisComponentes.Query.parameters.ParamByName('acode').Value:=CommBlock.acode;
MisComponentes.Query.open;
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;
Protocol.Lines.Add (TimeToStr(Time)+' The process for '+CommBlock.MyUserName+' was done '); NewCommBlock.Command := 'DIALOG'; NewCommBlock.MyUserName := '[PBX Server]'; NewCommBlock.Msg := 'The process was done '; NewCommBlock.ReceiverName := '[return-to-sender]'; AThread.Connection.WriteBuffer (NewCommBlock, SizeOf (NewCommBlock), true); end;
end;