Ver Mensaje Individual
  #1  
Antiguo 07-03-2009
Avatar de kurono
[kurono] kurono is offline
Miembro Premium
 
Registrado: jul 2007
Ubicación: Republica Dominicana
Posts: 1.144
Reputación: 20
kurono Va por buen camino
ayuda en hilo

hola amigos tengo un problema con un hilo de ejecucion pues e puesto un codigo ahi y me da un error diciendome que el hilo no es compatible con la clase Tcomponent bueno le muestro el codigo lo q esta en rojo es donde me presenta el error

Código Delphi [-]
unit MyHilo;

interface

uses
  Forms, Controls, StdCtrls, Windows,Classes, Dialogs, SysUtils,
  DCPcrypt2, DCPblockciphers, DCPblowfish, DCPsha512, DCPcast128,
  DCPcast256, DCPidea, DCPice, DCPdes, DCPrc6, DCPrc5, DCPrc4, DCPrc2,
  DCPmisty1, DCPmars, DCPtwofish, DCPtea, DCPserpent, DCPrijndael, DCPtiger,
  DCPsha256, DCPsha1, DCPripemd160, DCPripemd128, DCPmd5, DCPmd4, DCPhaval,
  Buttons, Gauges, ComCtrls, ExtCtrls;

type
  TMyhilo = class(TThread)
  private
    { Private declarations }
  protected
    procedure Execute;override;
    procedure update_frmprincipal;
  end;

implementation
uses
  UfrmPrincipal;
procedure TMyhilo.Execute;
  var
   cifrar:Boolean;
  cifrador: TDCP_cipher;
  fsOrigen, fsDestino: TStream;
begin
  Synchronize(update_frmprincipal);
  fsOrigen := TFileStream.Create(frmPrincipal.edOrigen.Text,fmOpenRead);
  fsDestino := TFileStream.Create(frmPrincipal.edDestino.Text, fmCreate);
  cifrador:= TDCP_cipher.Create(self);
  try
    case cbAlgoritmo.ItemIndex of
       0: cifrador := TDCP_blowfish.Create(Self);
       1: cifrador := TDCP_cast128.Create(Self);
       2: cifrador := TDCP_cast256.Create(Self);
       3: cifrador := TDCP_des.Create(Self);
       4: cifrador := TDCP_3des.Create(Self);
       5: cifrador := TDCP_thinice.Create(Self);
       6: cifrador := TDCP_ice2.Create(Self);
       7: cifrador := TDCP_idea.Create(Self);
       8: cifrador := TDCP_mars.Create(Self);
       9: cifrador := TDCP_misty1.Create(Self);
      10: cifrador := TDCP_rc2.Create(Self);
      11: cifrador := TDCP_rc4.Create(Self);
      12: cifrador := TDCP_rc5.Create(Self);
      13: cifrador := TDCP_rc6.Create(Self);
      14: cifrador := TDCP_rijndael.Create(Self);
      15: cifrador := TDCP_serpent.Create(Self);
      16: cifrador := TDCP_serpent.Create(Self);
      17: cifrador := TDCP_twofish.Create(Self);
    end;
    case cbHash.ItemIndex of
      0: cifrador.InitStr(edContrasena.Text, TDCP_haval);
      1: cifrador.InitStr(edContrasena.Text, TDCP_md4);
      2: cifrador.InitStr(edContrasena.Text, TDCP_md5);
      3: cifrador.InitStr(edContrasena.Text, TDCP_ripemd128);
      4: cifrador.InitStr(edContrasena.Text, TDCP_ripemd160);
      5: cifrador.InitStr(edContrasena.Text, TDCP_sha1);
      6: cifrador.InitStr(edContrasena.Text, TDCP_sha256);
      7: cifrador.InitStr(edContrasena.Text, TDCP_sha384);
      8: cifrador.InitStr(edContrasena.Text, TDCP_sha512);
      9: cifrador.InitStr(edContrasena.Text, TDCP_tiger);
    end;
    if cifrar then
    cifrador.EncryptStream(fsOrigen, fsDestino, fsOrigen.Size)
    else
    cifrador.DecryptStream(fsOrigen, fsDestino, fsOrigen.Size);
    cifrador.Burn;
  finally
    cifrador.Free;
    fsOrigen.Free;
    fsDestino.Free;
      end;
  end;
procedure myhilo.update_frmprincipal;
  begin
    frmPrincipal.Caption:='Encriptador 1.1';
    end;
end.
Responder Con Cita