Ver Mensaje Individual
  #2  
Antiguo 05-09-2010
Avatar de duilioisola
[duilioisola] duilioisola is offline
Miembro Premium
 
Registrado: ago 2007
Ubicación: Barcelona, España
Posts: 1.734
Reputación: 20
duilioisola Es un diamante en brutoduilioisola Es un diamante en brutoduilioisola Es un diamante en bruto
Puedes utilizar TStringList, por ejemplo. Creo que es lo más sencillo:

Código Delphi [-]
var
   ts : TStrings;
   h : word; //creo
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; //creo
begin
   AssignFile (f,'c:\ruta\archivo.logesea');
   try
      Reset(f);
      while (not f.Eof) do // Mientras no llegue al final
      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.
Responder Con Cita