Cita:
Empezado por escafandra
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.
|
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