blob: 376e75cba08ac8121c1be2b9639b7248f2b22b4c (
plain)
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
|
{}
// wParam: 1/0 (enable/disable), lParam = task name
// works for all tasks with same started name
function TaskEnable(wParam:WPARAM;lParam:LPARAM):int_ptr;cdecl;
var
i,j:integer;
begin
result:=0;
if lParam=0 then exit;
j:=StrLenW(pWideChar(lParam));
for i:=0 to MaxTasks-1 do
begin
if (TaskList[i].flags and ACF_ASSIGNED)<>0 then
begin
if StrCmpW(TaskList[i].name,pWideChar(lParam),j)=0 then
begin
if wParam=0 then // disable
begin
if (TaskList[i].flags and ACF_DISABLED)=0 then
begin
inc(result);
TaskList[i].flags:=TaskList[i].flags or ACF_DISABLED;
if TaskList[i].timer<>0 then
begin
KillTimer(0,TaskList[i].timer);
TaskList[i].timer:=0;
end;
end;
end
else
begin
if (TaskList[i].flags and ACF_DISABLED)<>0 then
begin
inc(result);
TaskList[i].flags:=TaskList[i].flags and not ACF_DISABLED;
SetTask(TaskList[i]);
end;
end;
end;
end;
end;
end;
function TaskDelete(wParam:WPARAM;lParam:LPARAM):int_ptr;cdecl;
var
i,j:integer;
begin
result:=0;
if lParam=0 then exit;
j:=StrLenW(pWideChar(lParam));
for i:=0 to MaxTasks-1 do
begin
if (TaskList[i].flags and ACF_ASSIGNED)<>0 then
begin
if StrCmpW(TaskList[i].name,pWideChar(lParam),j)=0 then
begin
TaskList[i].flags:=TaskList[i].flags and not ACF_ASSIGNED;
end;
end;
end;
end;
function TaskCount(wParam:WPARAM;lParam:LPARAM):int_ptr;cdecl;
var
i,j:integer;
begin
result:=0;
if lParam=0 then exit;
j:=StrLenW(pWideChar(lParam));
for i:=0 to MaxTasks-1 do
begin
with TaskList[i] do
begin
if (flags and ACF_ASSIGNED)<>0 then
begin
if StrCmpW(name,pWideChar(lParam),j)=0 then
begin
result:=count;
count:=wParam;
end;
end;
end;
end;
end;
|