[python-win32] Retrieve Icons Associated To An Extension?

Mark Hammond mhammond at skippinet.com.au
Wed Mar 30 00:08:54 CEST 2005


One way is code similar to:

    from win32com.shell import shell, shellcon

    flags = shellcon.SHGFI_LARGEICON | shellcon.SHGFI_ICON | \
            shellcon.SHGFI_USEFILEATTRIBUTES
    hr, info = shell.SHGetFileInfo(extension,
win32con.FILE_ATTRIBUTE_NORMAL,
                                   flags)
    hicon, iicon, attr, display_name, type_name = info

Mark


> -----Original Message-----
> From: python-win32-bounces at python.org
> [mailto:python-win32-bounces at python.org]On Behalf Of
> andrea.gavana at agip.it
> Sent: Wednesday, 30 March 2005 1:21 AM
> To: python-win32 at python.org
> Subject: [python-win32] Retrieve Icons Associated To An Extension?
>
>
> Hello NG,
>
>       I have searched everyweher, and I am not able to find a
> solution...
> basically, I am constructing a GUI with wxPython, in which I
> have a list.
> In this list control, I have some file. I would like to
> associate (to every
> file) its icon (on Windows). I have searched about the use of Mark
> Hammond's win32all extensions and also ctypes, but I didn't find a
> solution. Could anyone please provide a very simple example on how to
> retrieve an icon associated to a file extension on Windows?
>
> Thank you a lot.
>
> Andrea.
>
> --------------------------------------------------------------
> --------------------------------------------------------------
> --------------
>  Message for the recipient only, if received in error, please
> notify the
> sender and read http://www.eni.it/disclaimer/
>
>
> _______________________________________________
> Python-win32 mailing list
> Python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32



More information about the Python-win32 mailing list