-
Notifications
You must be signed in to change notification settings - Fork 2
/
UntThread.pas
91 lines (70 loc) · 1.81 KB
/
UntThread.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
unit UntThread;
interface
uses
Classes;
type
CarregaFile = class(TThread)
private
{ Private declarations }
protected
procedure Execute; override;
procedure CarregaFileThread;
end;
implementation
{
Important: Methods and properties of objects in visual components can only be
used in a method called using Synchronize, for example,
Synchronize(UpdateCaption);
and UpdateCaption could look like,
procedure CarregaFile.UpdateCaption;
begin
Form1.Caption := 'Updated in a thread';
end;
or
Synchronize(
procedure
begin
Form1.Caption := 'Updated in thread via an anonymous method'
end
)
);
where an anonymous method is passed.
Similarly, the developer can call the Queue method with similar parameters as
above, instead passing another TThread class as the first parameter, putting
the calling thread in a queue with the other thread.
}
{ CarregaFile }
procedure CarregaFile.CarregaFileThread;
begin
end;
procedure CarregaFile.Execute;
begin
editArquivo.Text = EmptyStr then
Begin
if OpenDialog1.Execute then
//editArquivo.Text:= OpenDialog1.FileName;
if editArquivo.Text = EmptyStr then
begin
Application.MessageBox('O diretorio não foi informado ou o arquivo não foi selecionado!',
'Diretório vazio', MB_ICONINFORMATION+MB_OK);
if editArquivo.CanFocus then
edtComparar.SetFocus;
exit;
end;
editResult.text:= MD5(editArquivo.Text);
End
else
Begin
if FileExists(editArquivo.Text) then
editResult.text:= MD5(editArquivo.Text)
else
begin
Application.MessageBox('Diretorio Inválido',
'Inválido', MB_ICONINFORMATION+MB_OK);
if editArquivo.CanFocus then
edtComparar.SetFocus;
exit;
end;
End;
end;
end.