Puedes utilizar TStringList, por ejemplo. Creo que es lo más sencillo:
Código Delphi
[-]var
ts : TStrings;
h : word; begin
ts := TStringList.Create;
try
ts.LoadFromFile('c:\ruta\archivo.loquesea');
for i=0 to ts.Count -1 do
begin
h := FindWindow(nil, ts[i]);
if h <> 0 then PostMessage(h, WM_CLOSE, 0, 0);
end;
finally
ts.Free;
end;
end;
También puedes utilizar AssignFile y ReadLn:
Código Delphi
[-]
var
f : TextFile;
s : string;
h : word; begin
AssignFile (f,'c:\ruta\archivo.logesea');
try
Reset(f);
while (not f.Eof) do begin
ReadLn(f,s);
h := FindWindow(nil, ts[i]);
if h <> 0 then PostMessage(h, WM_CLOSE, 0, 0);
end;
finally
CloseFile(f);
end;
end;
Nota: El código puede contener errores, pues lo hice sin un Delphi en frente.