A. Get a window handle and close the pid using the Win32API …
Example watir:
hWnd ||= Watir::IE::Process.process_id_from_hwnd @b.hwnd pid=" " * 32 thread=Win32API.new("user32", "GetWindowThreadProcessId", 'IP', 'I').Call(hWnd,pid) puts pid.unpack("L")[0] right_to_terminate_process = 1 handle = Win32API.new('kernel32.dll', 'OpenProcess', 'lil', 'l'). call(right_to_terminate_process, 0, hWnd) Win32API.new('kernel32.dll', 'TerminateProcess', 'll', 'l').call(handle, 0)
