Hola a todos hay algunos factores a tomar en cuenta para hacer una dll con indy 10.6.2 y su componente TidTCPClient?, ya que quiero convertir un exe, que funciona sin problemas, y al pasarlo a dll, me genera Access Violations, en 2 partes que con el exe no lo hace; lo más raro de todo, es que lo hace bien la primera vez, dejo la parte del código(comento las parte donde me da el error dónde tengo el problema), gracias de antemano.
delphi
procedure TfmConfiguracion.btCargaFamiliasClick(Sender: TObject); var R, Codigo :String; JF :TJSONObject; Familia :TFamilia; NumB, i :Integer; begin if (edCaja.Text <> '') and (edTurno.Text <> '') then begin if NumFam = 0 then begin SetLength(AFam, NumFam + 1); AFam[NumFam] := '000000'; Codigo := AFam[NumFam]; end else if (Sender is TFamilia) then begin SetLength(AFam, NumFam + 1); AFam[NumFam] := (Sender as TFamilia).Codigo; Codigo := AFam[NumFam]; end else begin Codigo := AFam[NumFam]; end; // Aquí me manda un Access Violation, la tercera vez que le doy click al boton que dice "cerveza", // pero no me da el error si le doy click al boton que dice "brandy" ClienConLocal.SendCmd('carga_familia ' + Codigo + ' ' + edCaja.Text + ' ' + edTurno.Text + ' ' + IDCliente); R := ClienConLocal.LastCmdResult.Text.Text; JF := TJSONObject.Parse(R) as TJSONObject; NumB := JF['botones'].Count; if (NumB > 0) or (JF.S['ayb_fam'] = 'F') then begin LimpiarPanel(pnFamilias); Inc(NumFam); end else begin if MessageDlg('¿Estás seguro de agregar ' + (Sender as Tfamilia).Descripcion + ' a Terminados?', mtConfirmation, [mbYes, mbNo], 0, mbYes) = mrYes then begin LlenarGrid(Sender); end; end; for i := 1 to NumB do begin Familia := TFamilia.Create(pnFamilias);//Despúes de 3 veces de darle click, me manda el Acces Violation Familia.Descripcion := TBase64Encoding.Base64.Decode(JF['botones'].ArrayValue.O[i - 1].S['descrip']); Familia.Caption := TBase64Encoding.Base64.Decode(JF['botones'].ArrayValue.O[i - 1].S['descrip']); Familia.Codigo := JF['botones'].ArrayValue.O[i - 1].S['codigo']; Familia.Precio := JF['botones'].ArrayValue.O[i - 1].S['precio']; Familia.Impto1 := JF['botones'].ArrayValue.O[i - 1].S['impto1']; Familia.Impto2 := JF['botones'].ArrayValue.O[i - 1].S['impto2']; Familia.Imprime := JF['botones'].ArrayValue.O[i - 1].S['imprime']; Familia.Servicio := JF['botones'].ArrayValue.O[i - 1].S['servicio']; Familia.AyB_Fam := JF['botones'].ArrayValue.O[i - 1].S['tipo_ayb']; if JF['botones'].ArrayValue.O[i - 1].S['terminado'] = 'S' then Familia.Terminado := True else Familia.Terminado := False; Familia.Enabled := Familia.Terminado; if JF['botones'].ArrayValue.O[i - 1].S['indica'] <> '' then Familia.Indicaciones := JF['botones'].ArrayValue.O[i - 1].S['indica']; if JF['botones'].ArrayValue.O[i - 1].S['sugerencias'] <> '' then Familia.Sugerencias := JF['botones'].ArrayValue.O[i - 1].S['sugerencias']; Familia.Parent := pnFamilias; Familia.Font.Size := 10; Familia.WordWrap := True; Familia.Width := 90; Familia.Height := 90; Familia.Margins.Left := 5; Familia.Margins.Top := 5; Familia.Margins.Right := 5; Familia.Margins.Bottom := 5; Familia.OnClick := btCargaFamiliasClick; end; end else ShowMessage('Los campos Caja y Turno son obligatorios'); end;