Ver Mensaje Individual
  #9  
Antiguo 06-09-2010
fleming fleming is offline
Miembro
 
Registrado: sep 2010
Posts: 15
Reputación: 0
fleming Va por buen camino
Cita:
Empezado por escafandra Ver Mensaje
Prueba asi:

Código Delphi [-]
var
   ts : TStrings;
   h : word; //creo
   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; //creo
begin
   AssignFile (f,'prueba.txt');
   try
      Reset(f);
      while (not Eof(f)) do // Mientras no llegue al final
      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.
Me funciono de maravilla no se que estaria haciendo mal pero a la final lo hice desde 0 y me funciono ahora.. como hago para poner una alerta, antes de cerrar el proceso con:

MessageBox(0, 'Programa Prohibido Detectado!', 'Alerta', +MB_OK +mb_ICONWARNING); PostMessage(h, WM_CLOSE, 0, 0);



PostMessage me funciona pero la alerta la hace infinitamente..! como hago para que me salga una sola ves al precionarle aceptar procede a WM_close
Responder Con Cita