Ir al contenido


Foto

Componente indy TidTCPClient dentro de una dll


  • Por favor identifícate para responder
No hay respuestas en este tema

#1 Punzo

Punzo

    Member

  • Miembros
  • PipPip
  • 24 mensajes

Escrito 07 enero 2021 - 02:15

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
  1. procedure TfmConfiguracion.btCargaFamiliasClick(Sender: TObject);
  2. var
  3. R, Codigo :String;
  4. JF :TJSONObject;
  5. Familia :TFamilia;
  6. NumB, i :Integer;
  7. begin
  8. if (edCaja.Text <> '') and (edTurno.Text <> '') then
  9. begin
  10. if NumFam = 0 then
  11. begin
  12. SetLength(AFam, NumFam + 1);
  13. AFam[NumFam] := '000000';
  14. Codigo := AFam[NumFam];
  15. end
  16. else if (Sender is TFamilia) then
  17. begin
  18. SetLength(AFam, NumFam + 1);
  19. AFam[NumFam] := (Sender as TFamilia).Codigo;
  20. Codigo := AFam[NumFam];
  21. end
  22. else
  23. begin
  24. Codigo := AFam[NumFam];
  25. end;
  26. // Aquí me manda un Access Violation, la tercera vez que le doy click al boton que dice "cerveza",
  27. // pero no me da el error si le doy click al boton que dice "brandy"
  28. ClienConLocal.SendCmd('carga_familia ' + Codigo + ' ' + edCaja.Text + ' ' + edTurno.Text + ' ' + IDCliente);
  29. R := ClienConLocal.LastCmdResult.Text.Text;
  30. JF := TJSONObject.Parse(R) as TJSONObject;
  31. NumB := JF['botones'].Count;
  32. if (NumB > 0) or (JF.S['ayb_fam'] = 'F') then
  33. begin
  34. LimpiarPanel(pnFamilias);
  35. Inc(NumFam);
  36. end
  37. else
  38. begin
  39. if MessageDlg('¿Estás seguro de agregar ' + (Sender as Tfamilia).Descripcion + ' a Terminados?',
  40. mtConfirmation, [mbYes, mbNo], 0, mbYes) = mrYes then
  41. begin
  42. LlenarGrid(Sender);
  43. end;
  44. end;
  45.  
  46. for i := 1 to NumB do
  47. begin
  48. Familia := TFamilia.Create(pnFamilias);//Despúes de 3 veces de darle click, me manda el Acces Violation
  49. Familia.Descripcion := TBase64Encoding.Base64.Decode(JF['botones'].ArrayValue.O[i - 1].S['descrip']);
  50. Familia.Caption := TBase64Encoding.Base64.Decode(JF['botones'].ArrayValue.O[i - 1].S['descrip']);
  51. Familia.Codigo := JF['botones'].ArrayValue.O[i - 1].S['codigo'];
  52. Familia.Precio := JF['botones'].ArrayValue.O[i - 1].S['precio'];
  53. Familia.Impto1 := JF['botones'].ArrayValue.O[i - 1].S['impto1'];
  54. Familia.Impto2 := JF['botones'].ArrayValue.O[i - 1].S['impto2'];
  55. Familia.Imprime := JF['botones'].ArrayValue.O[i - 1].S['imprime'];
  56. Familia.Servicio := JF['botones'].ArrayValue.O[i - 1].S['servicio'];
  57. Familia.AyB_Fam := JF['botones'].ArrayValue.O[i - 1].S['tipo_ayb'];
  58. if JF['botones'].ArrayValue.O[i - 1].S['terminado'] = 'S' then
  59. Familia.Terminado := True
  60. else
  61. Familia.Terminado := False;
  62. Familia.Enabled := Familia.Terminado;
  63. if JF['botones'].ArrayValue.O[i - 1].S['indica'] <> '' then
  64. Familia.Indicaciones := JF['botones'].ArrayValue.O[i - 1].S['indica'];
  65. if JF['botones'].ArrayValue.O[i - 1].S['sugerencias'] <> '' then
  66. Familia.Sugerencias := JF['botones'].ArrayValue.O[i - 1].S['sugerencias'];
  67. Familia.Parent := pnFamilias;
  68. Familia.Font.Size := 10;
  69. Familia.WordWrap := True;
  70. Familia.Width := 90;
  71. Familia.Height := 90;
  72. Familia.Margins.Left := 5;
  73. Familia.Margins.Top := 5;
  74. Familia.Margins.Right := 5;
  75. Familia.Margins.Bottom := 5;
  76. Familia.OnClick := btCargaFamiliasClick;
  77. end;
  78. end
  79. else
  80. ShowMessage('Los campos Caja y Turno son obligatorios');
  81. end;


  • 0




IP.Board spam blocked by CleanTalk.