Re: Icon of documents

new topic     » goto parent     » topic index » view thread      » older message » newer message

----- Original Message -----
From: "aku saya" <akusaya at gmx.net>
To: "EUforum" <EUforum at topica.com>
Subject: Icon of documents


>
>
> Using extractIcon(file) on Win32lib, I can get the file's icon, but
> for executable only. How about getting the default icon for other
> files, like in Explorer? (e.g. txt, doc, bmp).
>
> Thanks!

There might be a Windows built-in (api) for this but if not, you need to
uset the Registry entries. For example, on my system the ".bmp" is
associated with IrfanView so Explorer displays IrfanView's icon.

Find the Registry key

  \HKEY_CLASSES_ROOT\.bmp

its value on my machine is "IrfanView.bmp", so find

  \HKEY_CLASSES_ROOT\IrfanView.bmp\shell\open\command

if this exists it will have a program name. In my case its value is

  "C:\Program Files\IrfanView\I_VIEW32.EXE" "%1"

if this key doesn't exist try to find ...

  \HKEY_CLASSES_ROOT\IrfanView.bmp\DefaultIcon

if this exists it may also show a program. In my case I find ...

   C:\Program Files\IrfanView\I_VIEW32.EXE,0

Note that the specific icon is shown as ",0" after the program name.

Once you hae the file name, you can use extractIcon() to get it.

Good luck.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu