-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathThread.pas
More file actions
56 lines (45 loc) · 854 Bytes
/
Copy pathThread.pas
File metadata and controls
56 lines (45 loc) · 854 Bytes
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
unit Thread;
interface
uses
System.Classes, SysUtils, Windows;
type
TMyThread = class(TThread)
private
FCancelled: Boolean;
public
constructor Create;
procedure Execute; override;
procedure Cancel;
property Cancelled: Boolean read FCancelled;
end;
implementation
{ TMyThread }
uses
MainForm,Mediatek,Vcl.Graphics;
constructor TMyThread.Create;
begin
inherited Create(True); // Create suspended
FreeOnTerminate := True;
FCancelled := False;
end;
procedure TMyThread.Execute;
var
i: Integer;
info : MTKIn;
begin
try
connect_device(info);
except
on E: Exception do
begin
mform.err;
mform.adlg(E.Message,clred,true);
end;
end;
end;
procedure TMyThread.Cancel;
begin
FCancelled := True;
Terminate;
end;
end.