findwindow找出线程Handle,
CloseHandle终止。
var
WindowName : integer;
ProcessId : integer;
ThreadId : integer;
HandleWindow : Integer;
const
WindowTitle = 'aaa';
begin
WindowName := FindWindow(nil,WindowTitle);
If WindowName = 0 then
Exit;
ThreadId := GetWindowThreadProcessId(WindowName,@ProcessId);
HandleWindow := OpenProcess(PROCESS_ALL_ACCESS,False,ProcessId);
closehandle(HandleWindow);
end;