Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 16-07-2004
Avatar de DarkByte
DarkByte DarkByte is offline
Miembro
 
Registrado: sep 2003
Ubicación: Desconocido
Posts: 1.322
Poder: 22
DarkByte Va por buen camino
Error: RichEdit line insertation error

Saludos.

Estoy intentando hacer un programa que encripte el texto a medida que se escribe y cuando escribo por ejemplo, al principio, un montón de "aches"
Cita:
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh hh
Me lanza:
Cita:
Project Project1.exe raised exception class EOutOfResources with message 'RichEdit line insertation error'.
Proccess stopped. Use Step or Run to continue
¿Qué significa?. ¿Que no tengo recursos?.

Dejo aquí la unit
Código Delphi [-]
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, ExtCtrls, StdCtrls, Menus;

type
  TForm1 = class(TForm)
    MainMenu1: TMainMenu;
    StatusBar1: TStatusBar;
    Bevel1: TBevel;
    reTexto: TRichEdit;
    Programa1: TMenuItem;
    Vision1: TMenuItem;
    Modofraseafrase1: TMenuItem;
    mmEncriptado: TRichEdit;
    Borrartodo1: TMenuItem;
    Edicin1: TMenuItem;
    Borrartodo2: TMenuItem;
    procedure Modofraseafrase1Click(Sender: TObject);
    procedure Borrartodo2Click(Sender: TObject);
    procedure reTextoChange(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  Clave: Word;
  MFrase: Boolean;

implementation

{$R *.dfm}
const
    {C1 y C2 are used for encryption of Master Password string}
    {C1 y C2 aon usadas para encriptar la cadena de la clave}
         C1 = 25895;
         C2 = 09617;
         C3 = 65127;


      { Standard Decryption algorithm - Copied from Borland}
      function Decrypt(const S: String; Key: Word): String;
      var
        I: byte;
      begin
        SetLength(Result,Length(S));
        for I := 1 to Length(S) do begin
          Result[i] := char(byte(S[i]) xor (Key shr 8));
          Key := (byte(S[i]) + Key) * C1 + C2 + C3;
        end;
      end;

      { Standard Encryption algorithm - Copied from Borland}
      function Encrypt(const S: String; Key: Word): String;
      var
        I: byte;
      begin
        SetLength(Result,Length(S));
        for I := 1 to Length(S) do begin
          Result[i] := char(byte(S[i]) xor (Key shr 8));
          Key := (byte(Result[i]) + Key) * C1 + C2 +C3;
        end;
      end;
procedure TForm1.Modofraseafrase1Click(Sender: TObject);
begin
  If Modofraseafrase1.Checked = True then
    begin
      MFrase := True;
    end
  Else
    begin
      MFrase := False;
    end;
end;

procedure TForm1.Borrartodo2Click(Sender: TObject);
begin
  mmEncriptado.Clear;
  reTexto.Clear;
end;

procedure TForm1.reTextoChange(Sender: TObject);
var
  I:integer;
begin
  Clave :=9681;
  mmEncriptado.Clear;
  If MFrase <> True Then
    begin
     for I:=0 to reTexto.Lines.Count do
      begin
        mmEncriptado.Lines.Add(Encrypt(reTexto.Lines[i],Clave));
      end;
     end
  Else
    begin
     for I:=0 to reTexto.Lines.Count do
       begin
        with mmEncriptado do
        begin
        try SelAttributes.Color := clRed;
          except ShowMessage ('Error al colorear el texto desencriptado'); end;
          try mmEncriptado.Lines.Add(reTexto.Lines[i]);
            except ShowMessage ('Error al escribir la línea desencriptada');end;
        end;
      with mmEncriptado do
        begin
        try SelAttributes.Color := clBlue;
          except ShowMessage ('Error al colorear el texto encriptado'); end;
        try mmEncriptado.Lines.Add(Encrypt(reTexto.Lines[i],9681));
        except ShowMessage ('Error al escribir la linea encriptada'); end;
      end;
      end;
     end
end;

end.
__________________
:)
Responder Con Cita
  #2  
Antiguo 16-07-2004
Avatar de DarkByte
DarkByte DarkByte is offline
Miembro
 
Registrado: sep 2003
Ubicación: Desconocido
Posts: 1.322
Poder: 22
DarkByte Va por buen camino
Añado que cuando estoy en modo "Frase a Frase", es decir, escribiendo arriba la original y debajo la encriptada, me lanza:

Cita:
Error al escribir la línea encriptada
Por lo que supongo que el error estará en
Código Delphi [-]
      with mmEncriptado do
        begin
        try SelAttributes.Color := clBlue;
          except ShowMessage ('Error al colorear el texto encriptado'); end;
        try mmEncriptado.Lines.Add(Encrypt(reTexto.Lines[i],9681));
         //------------AQUI SALTA EL MENSAJE------------
        except ShowMessage ('Error al escribir la linea encriptada'); end;
      end;
__________________
:)
Responder Con Cita
  #3  
Antiguo 16-07-2004
Avatar de DarkByte
DarkByte DarkByte is offline
Miembro
 
Registrado: sep 2003
Ubicación: Desconocido
Posts: 1.322
Poder: 22
DarkByte Va por buen camino
Otra cosita ahora que caigo... mmEncriptado también es un RichEdit
__________________
:)
Responder Con Cita
  #4  
Antiguo 19-07-2004
Avatar de DarkByte
DarkByte DarkByte is offline
Miembro
 
Registrado: sep 2003
Ubicación: Desconocido
Posts: 1.322
Poder: 22
DarkByte Va por buen camino
:s Como veo que la respuesta se demora mucho para lo normal en clubdelphi, ruego que me avisen si me he equivocado o faltado a la Guía de Estilo en la pregunta y también añadir que uso Delphi 7 Enterprise bajo WinXp en un AMD Anthlon con 1Gb de memoria ram, pantalla TFT de no me acuerdo cuantas pulgadas, 6 puertos USB, altavoces con Dolby Sorrund 3.1 (Agiler), webcam Dexxa, Grabadora de cd's Lg (52x24x52x), lector de DVD Lg también....

Me parece que ya he dado suficiente información
__________________
:)
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 18:17:54.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi