Prueba asi:
Código Delphi
[-]
var
ts : TStrings;
h : word; i: integer;
begin
ts := TStringList.Create;
try
ts.LoadFromFile('prueba.txt');
for i:=0 to ts.Count -1 do
begin
h := FindWindow(nil, PCHAR(ts[i]));
if h <> 0 then PostMessage(h, WM_CLOSE, 0, 0);
end;
finally
ts.Free;
end;
end;
o así:
Código Delphi
[-]
var
f : TextFile;
s : string;
h : word; begin
AssignFile (f,'prueba.txt');
try
Reset(f);
while (not Eof(f)) do begin
ReadLn(f,s);
h := FindWindow(nil, PCHAR(s));
if h <> 0 then PostMessage(h, WM_CLOSE, 0, 0);
end;
finally
CloseFile(f);
end;
end;
Saludos.