Einzelnen Beitrag anzeigen

Benutzerbild von MiniKeks
MiniKeks

Registriert seit: 19. Jul 2005
103 Beiträge
 
Delphi 7 Professional
 
#4

Re: Mein Programm schliesst sich automatisch?!

  Alt 5. Sep 2006, 20:56
Delphi-Quellcode:
program ExFile;

uses
  Forms,
  QForms,
  ExFile1 in 'ExFile1.pas{Form1};

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.

Delphi-Quellcode:
unit ExFile1;

interface

uses
{$IFDEF WIN32}
  Windows,
  Messages,
  Graphics,
  Controls,
  Forms,
  Dialogs,
  StdCtrls,
  Buttons,
{$ENDIF}
{$IFDEF LINUX}
  QForms,
  QDialogs,
  QStdCtrls,
  QControls,
  QButtons,
{$ENDIF}
  SysUtils,
  Classes, ImgList, JvExControls, JvComponent, shellapi, JvXPCore, JvXPBar, XPMan,
  JvXPButtons, JvXPCheckCtrls, JvComponentBase, JvFormMagnet, Menus, jpeg,
  ExtCtrls, ComCtrls;

type
  TForm1 = class(TForm)
    btnGo: TButton;
    OpenDialog1: TOpenDialog;
    SaveDialog1: TSaveDialog;
    JvXPBar1: TJvXPBar;
    JvXPBar2: TJvXPBar;
    ImageList1: TImageList;
    GroupBox1: TGroupBox;
    XPManifest1: TXPManifest;
    GroupBox2: TGroupBox;
    edtInFile: TEdit;
    edtOutFile: TEdit;
    GroupBox3: TGroupBox;
    cbxCipher: TComboBox;
    GroupBox4: TGroupBox;
    edtPassphrase: TEdit;
    chkEncrypt: TJvXPCheckbox;
    JvXPButton1: TJvXPButton;
    JvXPButton2: TJvXPButton;
    JvXPButton3: TJvXPButton;
    JvFormMagnet1: TJvFormMagnet;
    JvXPButton4: TJvXPButton;
    PopupMenu1: TPopupMenu;
    PasswortGenerieren1: TMenuItem;
    Schnellgeneration1: TMenuItem;
    N8Zeichen1: TMenuItem;
    N16Zeichen1: TMenuItem;
    N32Zeichen1: TMenuItem;
    N64Zeichen1: TMenuItem;
    JvXPButton5: TJvXPButton;
    JvXPButton6: TJvXPButton;
    JvXPButton7: TJvXPButton;
    Image2: TImage;
    StatusBar1: TStatusBar;
    Label1: TLabel;
    Shape1: TShape;
    Shape2: TShape;
    Image1: TImage;
    Image3: TImage;
    Shape3: TShape;
    Shape4: TShape;
    procedure btnGoClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure SpeedButton1Click(Sender: TObject);
    procedure SpeedButton2Click(Sender: TObject);
    procedure JvXPButton1Click(Sender: TObject);
    procedure JvXPButton2Click(Sender: TObject);
    procedure JvXPButton3Click(Sender: TObject);
    procedure JvXPBar1Items1Click(Sender: TObject);
    procedure JvXPBar1Items0Click(Sender: TObject);
    procedure JvXPButton7Click(Sender: TObject);
    procedure JvXPButton5Click(Sender: TObject);
    procedure JvXPBar2Items2Click(Sender: TObject);
    procedure JvXPBar2Items1Click(Sender: TObject);
    procedure JvXPButton4Click(Sender: TObject);
    procedure JvXPButton1MouseEnter(Sender: TObject);
    procedure Image2MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure JvXPButton1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure Image2MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure Image2MouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure JvXPButton6Click(Sender: TObject);
  private
    procedure RefreshKeys;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

uses
  LbCipher, LbProc;

type
  TEncryption = (eBf, eBfCbc, eDes, eDesCbc, e3Des, e3DesCbc, eRdl, eRdlCbc);

var
  Key64 : TKey64;
  Key128 : TKey128;
  Key192 : TKey192;
  Key256 : TKey256;


procedure TForm1.FormCreate(Sender: TObject);
begin
groupbox3.Caption := 'Verschlüsselungsmethode';
groupbox1.caption := 'Input Datei';
groupbox2.caption := 'Output Datei';
chkencrypt.checked := true; //Verschlüsseln
  cbxCipher.ItemIndex := Integer(eRdlCbc);
 // edtpassphrase.passwordchar := '*';
 //form1.canclose := false;

end;

procedure TForm1.btnGoClick(Sender: TObject);
begin
  Screen.Cursor := crHourglass;
  RefreshKeys;
  try
    case TEncryption(cbxCipher.ItemIndex) of
      eBf : BFEncryptFile(edtInfile.Text, edtOutfile.Text, Key128, chkEncrypt.Checked);
      eBfCbc : BFEncryptFileCBC(edtInfile.Text, edtOutfile.Text, Key128, chkEncrypt.Checked);
      eDes : DESEncryptFile(edtInfile.Text, edtOutfile.Text, Key64, chkEncrypt.Checked);
      eDesCbc : DESEncryptFileCBC(edtInfile.Text, edtOutfile.Text, Key64, chkEncrypt.Checked);
      e3Des : TripleDESEncryptFile(edtInfile.Text, edtOutfile.Text, Key128, chkEncrypt.Checked);
      e3DesCbc : TripleDESEncryptFileCBC(edtInfile.Text, edtOutfile.Text, Key128, chkEncrypt.Checked);
      eRdl : RDLEncryptFile(edtInfile.Text, edtOutfile.Text, Key128, 16, chkEncrypt.Checked);
      eRdlCbc : RDLEncryptFileCBC(edtInfile.Text, edtOutfile.Text, Key128, 16, chkEncrypt.Checked);
    end;
  finally
    Screen.Cursor := crDefault;
  end;
end;

procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
  if OpenDialog1.Execute then
    edtInFile.Text := OpenDialog1.FileName;
end;

procedure TForm1.SpeedButton2Click(Sender: TObject);
begin
  if SaveDialog1.Execute then
    edtOutfile.Text := SaveDialog1.FileName;
end;

procedure TForm1.RefreshKeys;
begin
  GenerateLMDKey(Key64, SizeOf(Key64), edtPassphrase.Text);
  GenerateLMDKey(Key128, SizeOf(Key128), edtPassphrase.Text);
  GenerateLMDKey(Key192, SizeOf(Key192), edtPassphrase.Text);
  GenerateLMDKey(Key256, SizeOf(Key256), edtPassphrase.Text);
end;

procedure TForm1.JvXPButton1Click(Sender: TObject);
begin
  Screen.Cursor := crHourglass;
  RefreshKeys;
  try
    case TEncryption(cbxCipher.ItemIndex) of
      eBf : BFEncryptFile(edtInfile.Text, edtOutfile.Text, Key128, chkEncrypt.Checked);
      eBfCbc : BFEncryptFileCBC(edtInfile.Text, edtOutfile.Text, Key128, chkEncrypt.Checked);
      eDes : DESEncryptFile(edtInfile.Text, edtOutfile.Text, Key64, chkEncrypt.Checked);
      eDesCbc : DESEncryptFileCBC(edtInfile.Text, edtOutfile.Text, Key64, chkEncrypt.Checked);
      e3Des : TripleDESEncryptFile(edtInfile.Text, edtOutfile.Text, Key128, chkEncrypt.Checked);
      e3DesCbc : TripleDESEncryptFileCBC(edtInfile.Text, edtOutfile.Text, Key128, chkEncrypt.Checked);
      eRdl : RDLEncryptFile(edtInfile.Text, edtOutfile.Text, Key128, 16, chkEncrypt.Checked);
      eRdlCbc : RDLEncryptFileCBC(edtInfile.Text, edtOutfile.Text, Key128, 16, chkEncrypt.Checked);
    end;
  finally
    Screen.Cursor := crDefault;
  end;
end;

procedure TForm1.JvXPButton2Click(Sender: TObject);
begin
  if OpenDialog1.Execute then
    edtInFile.Text := OpenDialog1.FileName;
end;

procedure TForm1.JvXPButton3Click(Sender: TObject);
begin
  if SaveDialog1.Execute then
    edtOutfile.Text := SaveDialog1.FileName;
end;

procedure TForm1.JvXPBar1Items1Click(Sender: TObject);
begin
groupbox3.Caption := 'Entschlüsselungsmethode';
groupbox1.caption := 'Input Datei';
groupbox2.caption := 'Output Datei';
chkencrypt.checked := false; //Entschlüsseln
end;

procedure TForm1.JvXPBar1Items0Click(Sender: TObject);
begin
groupbox3.Caption := 'Verschlüsselungsmethode';
groupbox1.caption := 'Input Datei';
groupbox2.caption := 'Output Datei';
chkencrypt.checked := true; //Verschlüsseln
end;


... verdammt... so viel arbeit am arsch..
Menschen können sich ändern. Auch ich.
  Mit Zitat antworten Zitat