def simple_load_icon(module, index, as_data=False, size=ICON_SIZE):
 try:
  (large_icons, small_icons) = win32gui.ExtractIconEx(module, index, 10)
 except pywintypes.error as err:
  if (err.winerror != winerror.ERROR_FILE_NOT_FOUND):
   raise
  prints((u'File %r does not exist, cannot load icon' % module))
  return
 icons = (large_icons + small_icons)
 try:
  if icons:
   must_use_qt()
   pixmap = copy_to_size(QtWin.fromHICON(icons[0]), size=size)
   if as_data:
    return pixmap_to_data(pixmap)
   return QIcon(pixmap)
 finally:
  tuple(map(win32gui.DestroyIcon, icons))

def simple_load_icon ( module , index , as_data = False , size = ICON_SIZE ) : try : ( large_icons , small_icons ) = win32gui . ExtractIconEx ( module , index , 10 ) except pywintypes . error as err : if ( err . winerror != winerror . ERROR_FILE_NOT_FOUND ) : raise prints ( ( u'File %r does not exist, cannot load icon' % module ) ) return icons = ( large_icons + small_icons ) try : if icons : must_use_qt ( ) pixmap = copy_to_size ( QtWin . fromHICON ( icons [ 0 ] ) , size = size ) if as_data : return pixmap_to_data ( pixmap ) return QIcon ( pixmap ) finally : tuple ( map ( win32gui . DestroyIcon , icons ) )
use the win32 api extracticon to load the icon .