Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   ayuda en hilo (https://www.clubdelphi.com/foros/showthread.php?t=63892)

kurono 07-03-2009 17:11:05

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.

kurono 07-03-2009 17:32:37

amigos me disculpan pero ya solucione el problema era que debia hacer referencia en cifrador:= TDCP_cipher.Create(self); ponerlo de esta forma cifrador:= TDCP_cipher.Create(cifrador);


La franja horaria es GMT +2. Ahora son las 02:31:49.

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