def getWindows():    
titles = {}<EOL>def foreach_window(hwnd, lparam):<EOL><INDENT>if IsWindowVisible(hwnd):<EOL><INDENT>length = GetWindowTextLength(hwnd)<EOL>buff = ctypes.create_unicode_buffer(length + <NUM_LIT:1>)<EOL>GetWindowText(hwnd, buff, length + <NUM_LIT:1>)<EOL>titles[buff.value] = hwnd<EOL><DEDENT>return True<EOL><DEDENT>EnumWindows(EnumWindowsProc(foreach_window), <NUM_LIT:0>)<EOL>return titles<EOL>
Return dict: {'window title' : window handle} for all visible windows