Page 1 of 1

suggestion

Posted: Sun Sep 28, 2008 4:04 pm
by petrossa
to facilitate localisation i suggest the following codechange:

procedure TTaskItem.GetTasksLists(AList1: TStringlist; AList2: TStringlist;var Actions: array of integer);
var
iacoll: IActionCollection;
c: Integer;
I: Integer;
begin
with FInterface as IRegisteredTask do
begin
iacoll := get_Definition.Actions;
c := iacoll.Count;
for I := 1 to c do
begin
Actions[I-1] := iacoll.type_;
case iacoll.type_ of
TASK_ACTION_EXEC:
begin
AList2.Add(SStartProgram);
AList1.Add((iacoll as IExecAction).Path);
end;
TASK_ACTION_SEND_EMAIL:
begin
AList2.Add(sSendEmail);
AList1.Add((iacoll as IEMailAction).To_ + ' ' + (iacoll as
IEMailAction).Subject);
end;
TASK_ACTION_SHOW_MESSAGE:
begin
AList2.Add(sDisplayMessage);
AList1.Add((iacoll as IShowMessageAction).Title);
end;
end;
end;
end;
end;

Posted: Mon Sep 29, 2008 8:10 am
by isiticov
Could you please specify what change exactly you suggest?

Posted: Mon Sep 29, 2008 10:05 am
by petrossa
var Actions: array of integer added to the procedure parameter

Actions[I-1] := iacoll.type_; added to build a list of actiontypes

that way you can have knowledge of the kind of actions in vista without comparing the strings to a resource string.