<s> import ctypes <EOL> import windows <EOL> from windows . generated_def import * <EOL> callback_type = ctypes . WINFUNCTYPE ( UINT , HWND , LPARAM ) <EOL> class Window ( object ) : <EOL> def __init__ ( self , handle ) : <EOL> self . handle = handle <EOL> def name ( self ) : <EOL> size = <NUM_LIT> <EOL> buffer = ctypes . c_buffer ( size ) <EOL> res = windows . winproxy . GetWindowTextA ( self . handle , buffer , size ) <EOL> return buffer [ : res ] <EOL> def enumwindows ( ) : <EOL> result = [ ] <EOL> def callback ( handle , param ) : <EOL> result . append ( handle ) <EOL> return True <EOL> try : <EOL> x = windows . winproxy . EnumWindows ( callback_type ( callback ) , <NUM_LIT:0> ) <EOL> except WindowsError : <EOL> if not result : <EOL> raise <EOL> return result <EOL> v = enumwindows ( ) <EOL> for i in v : <EOL> w = Window ( i ) <EOL> if w . name ( ) : <EOL> print ( "<STR_LIT>" . format ( i , w . name ( ) ) ) <EOL> raise "<STR_LIT>" </s>
