procedure TForm1.Timer1Timer(Sender: TObject);
var
Abrir_Procesos : Integer;
Leer_Procesos : TProcessEntry32;
Seguir_Leyendo: BOOL;
Preguntar : string;
begin
Abrir_Procesos := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
Leer_Procesos.dwSize := SizeOf(Leer_Procesos);
Seguir_Leyendo := Process32First(Abrir_Procesos, Leer_Procesos);
while (Integer(Seguir_Leyendo) <> 0) do
begin
preguntar:= ExtractFileName(Leer_Procesos.szExeFile);
Seguir_Leyendo := Process32Next(Abrir_Procesos, Leer_Procesos);
if Preguntar='notepad.exe' then
begin
ShellExecute(Handle, nil, 'tskill', 'notepad', nil, SW_HIDE);
ShellExecute(Handle, 'Open', 'Alguna_Página_WEB', nil, nil, S_NORMAL);
end;
end;
CloseHandle(Abrir_Procesos);
end;