[python-win32] Overlay Icon Question...

Tim Golden mail at timgolden.me.uk
Mon Apr 14 18:07:22 CEST 2008


Andrea Gavana wrote:
> 1) I have looked the implementation mentioned in the link above, but
> it is a bit unclear to me: how do I actually *use* this class? All my
> users have the extension "*.DATA" associated with the Wordpad or
> Notepad or similar icons, as they use these editors to open these
> file? Should I tamper the registry where the *.DATA extension is
> stored? I am really lost here.

> Sorry for the very newbie questions, I am just a beginner with win32all.
> I have tried to mess around with some code found in CodeProject:
> http://www.codeproject.com/KB/shell/overlayicon.aspx
> And with the one in TortoiseSVN source code, but both are way over my head :-(

I'm afraid you haven't chosen a particularly easy entree into
the world of Windows! Some shell things (that's things which
affect the appearance and actions of Explorer and the Desktop)
are fairly easy to effect (and affect), requiring just some simple
registry manipulation. But the more complex and interesting things 
require what's known as a Shell Namespace Extension.

Basically, you register interest in one or more file types in the registry,
identifying a specific set of callbacks which the Shell (explorer.exe or 
whatever) calls whenever it sees a file in which you're interested.
This is the kind of thing which gives context-sensitive menus depending 
on file type and content and icon overlays of the sort you're describing.

> 2) Can I assign this overlay icon to a particular file (without
> touching the others with the same extension)? And if so, how?

In principle, yes. I haven't done it myself, but if someone more 
experienced doesn't chip in with an example, I'll try to put one together
myself. I warn you, though, with this kind of thing you're working within 
Windows: the pywin32 modules are simply wrapping the raw interface. 
So it won't be pretty!

> 3) Is the problem mentioned in the thread above still present? Will it
> affect also my GUI, even though it is writte in wxPython?

I must admit to no more than a passing familiarity with wxPython, but I'd
be rather surprised if it offered something as platform-specific and ticklish
as icon overlays for the Windows shell. I'd be very glad to be wrong for your
sake! If wxPython *does* offer overlays using pywin32 code, it will share that
code's problems; if they have their own implementation then probably not.

TJG


More information about the python-win32 mailing list