22.10.2009, 21:50
|
Новичок
|
|
Регистрация: 31.08.2008
Сообщения: 99
Репутация: 10
|
|
Я немного подправил выше написанный код:
Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, sButton, syncobjs, comctrls, sGroupBox;
Const
Symbol = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
type
TForm1 = class(TForm)
sGroupBox1: TsGroupBox;
Button1: TButton;
sGroupBox2: TsGroupBox;
Memo1: TMemo;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
tnew = class(tthread)
private
protected
procedure execute; override;
end;
var
Form1: TForm1;
new1, new2: tnew;
implementation
{$R *.dfm}
procedure tnew.execute;
procedure FindCombination(S: String; Level: Integer);
Var
i: Integer;
begin
for i := 1 to Length(Symbol) do
begin
Form1.Memo1.Lines.Add(S + Symbol[i]);
if Level < Length(Symbol) then FindCombination(S + Symbol[i],Level+1);
end;
end;
begin
FindCombination('',0);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
new1 := tnew.create(true);
new1.freeonterminate := true;
new1.priority := {tphighest}tptimecritical;
new1.resume;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
new1.Suspend;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Memo1.Lines.Clear;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
new1.Suspend;
new1.Terminate;
end;
end.
это даст возможность выполнения одновременно нескольких действий при подборе значений
|