#NEWLINE# def get_foreground_window( self ) : #NEWLINE# #INDENT# fhwnd = windll . user32 . GetForegroundWindow ( ) #NEWLINE# if fhwnd : #NEWLINE# #INDENT# if ( ( windll . user32 . GetWindowLongA ( fhwnd , ( - 16 ) ) & 8 ) == 0 ) : #NEWLINE# #INDENT# fhwnd = None #NEWLINE# #UNINDENT# #UNINDENT# return fhwnd