[python-win32] Overlay Icon Question...

Tim Golden mail at timgolden.me.uk
Wed Apr 16 13:13:05 CEST 2008


[Tim Golden]
>> Not that it matters too much, but if you're using a registry entry
>> anyway, why not simply list the files in the registry instead
>> of the double-indirection of having the registry reference a
>> file which holds the other files !?

[Andrea Gavana]
> I initially thought to do that, but then by reading this:
> 
> http://aspn.activestate.com/ASPN/docs/ActivePython/2.5/pywin32/win32api__RegSetValue_meth.html
> 
> And specifically this comment:
> 
> "Value lengths are limited by available memory. Long values (more than
> 2048 bytes) should be stored as files with the filenames stored in the
> configuration registry. This helps the registry perform efficiently."
> 
> I decided to do the double-indirection. It's not that complicated in the end :-D

Fair enough.

[Andrea Gavana]
> I was compiling my com server with the wrong py2exe parameters... now
> it works. I have a question anyway: since I don't know anything about
> COM servers and friends, will my COM server be restarted by Windows
> when the computer restart or a user logoff and logon again? Or should
> I find a way to register and restart it every time a user switch off
> and on his/her computer?

It's not quite a "server" in that sense. I don't know about the exact
mechanics, but in essence the shell will start it up on demand. (Probably
when the session starts, but I wouldn't be certain). The code you copied
from beneath the class definition achieves two things:

1) It says: "Whenever someone asks for server {01-23-45} go to
*this* DLL and pass it *that* id".

2) And it says: "Whenever the shell displays an icon, pass it along
to server {01-23-45} to let it overlay if it wants"

The effect is that the first time explorer wants to display an icon,
it runs through the list of icon-overlay-handlers, which includes
yours, finds your server's id (that {xx-yy} thing), finds that server's
entry in the registry, fires up the relevant code and passes along
whatever it does, causing your code to return an overlay or not. 
Or near enough.

> Thank you for your suggestions, this list has been very helpful and
> kind towards a completely pywin32-ignorant like me :-D

Glad we could help: that's what we're here for!

TJG


More information about the python-win32 mailing list